
Scheduling server commands
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:
administrator
papercut_command.bat
- A good place to put the file is within the PaperCut installation under
[app-path]\server\custom
cd c:\program files\papercut ng\server\bin\win server-command.exe disable-printer “printsrv1” “labprinter” “-1”
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).
Scheduling server-commands on Mac / Linux / Unix
On the unix-based platforms like Mac and Linux you can use the cron
scheduler. 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:
sudo su - papercut
crontab -e
10 4 1 * * mycommand
30 2 * * * mycommand
0 6 * * 0 mycommand
/home/papercut/PaperCut NG/server/bin/linux-686/server-command disable-printer “printsrv1” “labprinter” “-1”
/Applications/PaperCut NG/server/bin/mac/server-command disable-printer "printsrv1" "labprinter" "-1"
Categories: How-to Articles, Scripting and APIs
Comments