Applicable to:
- Plesk for Linux
Question
How to ensure that the cron service is working on a server?
Answer
-
Connect to a Plesk serer via SSH.
-
Check if the cron process is running with the following command:
# ps ax | grep cron | grep -v auto
135 ? Ss 0:00 /usr/sbin/crond -n -
Add a sample task to test the cron service:
3.1. Run the command:
# crontab -e
3.2. Add the following line at the end of the file:
CONFIG_TEXT: * * * * * /bin/echo "foobar" >> /root/cron-test.txt
3.3. Save changes and close the file.
3.4. After a minute, a text file
/root/cron-test
will appear with the word "foobar" in it and corresponding lines will appear in the cron logfile/var/log/cron
.
If the file was created, cron is working fine.3.4. Remove the line from crontab added on step 3.2.
-
If some scheduled task is not running, check the cron logfile to find out if this scheduled task was started or produced any errors:
# less /var/log/cron
Comments
0 comments
Please sign in to leave a comment.