Wondering how to add Cron Job in VestaCP? We can help you.
Cron is a time-based job scheduler that schedules jobs to run periodically at fixed times, days, or intervals.
Here at Bobcares, we handle requests from our customers to add Cron Job in VestaCP as a part of our Server Management Services. Today let’s see how our Support Engineers add crons for our customers.
Steps to add cron jobs in VestaCP
Following are the steps that our Support Engineers use to configure cron jobs in VestaCP:
1. Firstly, connect to VestaCP account.
2. Then click the CRON tab in VestaCP.
3. From here we can see the list of cron jobs. To create a new one, click the ADD CRON JOB button (green button “+”).
3. After that, we must enter the Command and the interval at which we want the cron job to execute.
Generally, VestaCP has some predefined values. So, we can choose the value we want and click the Generate button.
Tabs available in Vestacp
a. Minutes Tab: From the Minutes tab, we may select any option from the dropdown menu, then click generate. Every minute represents an asterisk (*) in the “Minutes” field on the left. Every 15 minutes would be reflected as */15, and so on.
b. Hourly Tab: The Hourly tab allows the cron job to be scheduled on the 0th, 15th, 30th or 45th minute of every 1, 2, 6 or 12 hours.
c. Daily Tab: The Daily tab allows the cron job to be scheduled every single, every odd or even or every 3, 5, 10 or 15 days. Beyond this, the cron job can be scheduled down to the hour and minute.
d. Weekly Tab: The Weekly tab allows scheduling for weekdays only, weekends only, every day or specific days of the week. Then the hour and minute can be specified.
e. Monthly Tab: The Monthly tab allows scheduling for every single, every odd or even, every 3 or 6 or a specific month. From there, the date, hour and minute can be selected.
4. After selecting the tab we can click the Add button. We will see a confirmation message “Cron job has been created successfully”.
5. We can also EDIT or DELETE cron jobs. Using the buttons available on the right side.
For checking the cron jobs, we can use the following command:
[root@webcp ~]# crontab -u bob -l
MAILTO=bob@bobcares.com
CONTENT_TYPE=”text/plain; charset=utf-8″
* * * * * php /home/bob/cron.php
[root@webcp ~]#
And to check the cron job log for a specific user, use:
cat /var/log/cron | grep bob
[root@webcp ~]# cat /var/log/cron | grep bob
Mar 30 08:06:01 webcp crond[188]: (bob) RELOAD (/var/spool/cron/bob)
Mar 30 08:06:01 webcp CROND[16439]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:07:01 webcp CROND[16475]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:07:11 webcp crontab[16484]: (root) LIST (bob)
Mar 30 08:08:01 webcp CROND[16488]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:09:01 webcp CROND[16497]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:10:01 webcp CROND[16516]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:11:01 webcp CROND[16712]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:12:01 webcp CROND[16725]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:12:01 webcp crontab[16731]: (root) LIST (bob)
Mar 30 08:13:01 webcp CROND[16737]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:14:01 webcp CROND[16748]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:15:01 webcp CROND[16761]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:16:01 webcp CROND[17277]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:17:01 webcp CROND[17287]: (bob) CMD (/home/bob/cron.php)
Mar 30 08:18:01 webcp CROND[17302]: (bob) CMD (/home/bob/cron.php)
[root@webcp ~]#
[Need assistance? We are available 24*7]
Conclusion
In short, we saw the steps that our Support Engineers follow to add cron jobs in VestaCP.
0 Comments