Administration
Background tasks

Configuring Cron for Linux

9min

The Cron job scheduler is a component of the Linux operating system. It is used to run server-side scripts according to a set schedule.

Starting with Passwork 5.1.0 there is a special script which is used to run the background tasks:

Shell


It can be executed manually or set to run on the Cron scheduler.

We recommend that you first test the script in manual mode. To do this, run the script:

Shell


Then, check the file at /var/www/app/logs/run-command.log for errors

Your user must have write access to the logs folder

Setting up Cron

Let's set up run-scheduled-tasks.php to launch every minute.

Open the Cron settings file:

Shell


Then add the line:

Shell


And save the file.

Testing and troubleshooting

Open Passwork under an administrator's account and open the Background tasks page.

If everything was set up correctly, you will see a message that the scheduler is configured:

Document image


If you see a message that the scheduler is not configured, runtime errors can be found in the log file at /var/www/app/logs/run-command.log. You can forward it to our technical support if you need help with troubleshooting.

Setting up a script to run as non-root user

By default, Cron runs scripts as a root user. You can set up another user with limited privileges to increase security.

First, log in as a required user:

Shell


Run the script to make sure that everything works correctly under user:

Shell


Check that user has write rights to the logs folder:

Shell


If no errors show up, set up Cron for user:

Shell


Add the following line:

Shell


And save the file.

Cron logs

To view the Cron log, use the following command:

Shell