How to create and delete cron jobs in Vesta

We will show in this article how to create a new cron job in VestaCP. Cron jobs are automated tasks that run on server at specific time intervals.

To configure cron jobs in Vesta:

1. Connect to your VestaCP account

2. Look at the top of the page for CRON link. Click on it.

vesta cron jobs1

3. You will see the list of the cron jobs. To create a new one, click the ADD CRON JOB button

vesta cron jobs2

4. Enter the Command (usually it’s the “php /path/to/the/script.php”) and the interval at which do you want the cron job to be executed. VestaCP has some predefined values – choose the value you want and click the Generate button.

vesta cron jobs3

5. Click the Add button. You will see a confirmation message Cron job has been created successfully.

6. You can also EDIT or DELETE cron jobs. Use the buttons on the right side.

vesta cron jobs4

You can check the cron jobs with the command crontab -u username -l :

[root@webcp ~]# crontab -u john -l
MAILTO=john@plothost.com
CONTENT_TYPE="text/plain; charset=utf-8"
* * * * * php /home/john/cron.php
[root@webcp ~]# 

To check the cron job log for a specific user use cat /var/log/cron | grep john :

[root@webcp ~]# cat /var/log/cron | grep john
Jul  6 08:06:01 webcp crond[188]: (john) RELOAD (/var/spool/cron/john)
Jul  6 08:06:01 webcp CROND[16439]: (john) CMD (/home/john/cron.php)
Jul  6 08:07:01 webcp CROND[16475]: (john) CMD (/home/john/cron.php)
Jul  6 08:07:11 webcp crontab[16484]: (root) LIST (john)
Jul  6 08:08:01 webcp CROND[16488]: (john) CMD (/home/john/cron.php)
Jul  6 08:09:01 webcp CROND[16497]: (john) CMD (/home/john/cron.php)
Jul  6 08:10:01 webcp CROND[16516]: (john) CMD (/home/john/cron.php)
Jul  6 08:11:01 webcp CROND[16712]: (john) CMD (/home/john/cron.php)
Jul  6 08:12:01 webcp CROND[16725]: (john) CMD (/home/john/cron.php)
Jul  6 08:12:01 webcp crontab[16731]: (root) LIST (john)
Jul  6 08:13:01 webcp CROND[16737]: (john) CMD (/home/john/cron.php)
Jul  6 08:14:01 webcp CROND[16748]: (john) CMD (/home/john/cron.php)
Jul  6 08:15:01 webcp CROND[16761]: (john) CMD (/home/john/cron.php)
Jul  6 08:16:01 webcp CROND[17277]: (john) CMD (/home/john/cron.php)
Jul  6 08:17:01 webcp CROND[17287]: (john) CMD (/home/john/cron.php)
Jul  6 08:18:01 webcp CROND[17302]: (john) CMD (/home/john/cron.php)
[root@webcp ~]#


The movie tutorial for this post:

cron jobs in Vesta
Next PostRead more articles

Leave a Reply