The server-command tools provides a lot of power to administrators to script and automate a variety of functionality in PaperCut. The server-command tool is documented in the manual in the Tools appendix chapter.
The server-command can be used to adjust user credit on an individual or group basis, enable/disable printers, run backups, perform user syncs, etc. Often an administrator will manually run these commands when required, however there are times when it’s useful to schedule a server-command to run on a regular basis. In this situation, the administrator can use the operating system scheduler to automatically run the task on a regular basis.
Scheduling server-commands on Windows
The Windows Task Scheduler can be used to automate running server-command. The steps below explain this process:
Log into the PaperCut
2. Create a batch file that contains the server command you wish to run. e.g.
A good place to put the file is within the PaperCut installation under
3. In your batch file add the command you want to run. e.g.:
cd c:\program files\papercut ng\server\bin\win
server-command.exe disable-printer “printsrv1” “labprinter” “-1”
Test your batch file to make sure it works as expected.
Use the Windows Task Scheduler
Start->Control Panel->Scheduled Tasks
to a new task that runs your batch file on the time you require. Ensure that you setup the task to run as a user that has permission to run “server-command” (i.e. a local administrator).
Note: More information on the Windows Task Scheduler in the Windows help system.
Scheduling server-commands on Mac / Linux / Unix
On the unix-based platforms like Mac and Linux you can use the
cron is a standard system service used to schedule regular jobs/tasks to be performed.
To setup a cron job to run a server-command:
Log into the PaperCut
server, as an administrator user.
Open a shell command prompt (e.g. Terminal on the Mac).
3. Logon as the “papercut” user. This will allow us to schedule the job to run as the “papercut” user. To logon as the “papercut” user, run the following.
sudo su - papercut
4. Edit the “papercut” user’s crontab file. Running the following command will open the “papercut” user’s crontab:
Each line of the crontab file defines a scheduled task to run. The 5 numbers preceding the command specify the time the job will be run (minutes, hours, day of month, month and day of week). Some examples are listed below:
To schedule a command to run at 4:10am on the first day of every month:
10 4 1 * * mycommand
To schedule a command to run at 2:30am every day:
30 2 * * * mycommand
To schedule a command to run at 6:00am each Sunday morning:
0 6 * * 0 mycommand
NOTE: You will need to replace “mycommand” above with the server-command and arguments you wish to run. e.g. on Linux
/home/papercut/PaperCut NG/server/bin/linux-686/server-command disable-printer “printsrv1” “labprinter” “-1”
Or on Mac:
/Applications/PaperCut NG/server/bin/mac/server-command disable-printer "printsrv1" "labprinter" "-1"
6. Save the file. The system will now automatically run the scheduled task as requested. You should check that the command runs when expected.