Now, you can set up DirectAdmin Cron like a pro. See how to schedule Cron jobs in DirectAdmin using the steps provided by our Tech Support Team.
Scheduling DirectAdmin Cron
Using the Linux program Cron, we can program commands or scripts to execute on the server automatically at a specified time and date. A Cron job is the name of the scheduled operation itself. An excellent tool for automating repetitive tasks is cron jobs.
Let’s look at how the DirectAdmin interface can be used to schedule the Cron job.
- Log into DirectAdmin to access the panel.
- Then click Cron jobs from the Advanced Features.
- The Cron Jobs Panel is displayed. Choose CREATE CRON JOB from the menu to proceed.
- The Create Cron Job panel is shown. We can set the time interval for the Cron job by entering values in the Minute, Hour, Day of Month, Month, and Day of Week fields.
- If we want to run a Cron job when we reboot, check the box next to Run on @reboot.
- Insert the Cron job command in the Command field, then click the CREATE button.
- Lastly, a success message appears and the Cron job is listed in the Cron Jobs panel.
- Enter the email address in the “Send all Cron output to E-mail” section to receive the results of Cron jobs via email. Then, to save the data, click “Save.”
A Few Important Details About the Cron Job
- The numbers and * that are indicated are Cron time values.
- By comma-separating, we can specify specific times. For e.g., 1,2,3.
- A dash can be used to specify spans. For e.g., 5-7.
- For intervals, use a star and a forward slash. For e.g., */2.
- We can combine them to create a more precise schedule. For e.g., 1,5,11-15,30-59/2. This refers to the minutes 1, 5, 11, and 15 as well as every 2nd minute from 30 to 59.
Based on the server configuration, we occasionally need to modify the file permission for the script we wish to use with a Cron job to 755. Although DirectAdmin does not recommend it, the server administrator can also use SSH to set up cron jobs for users. Use the command crontab -u username -e to change the Cron jobs for username. For e.g.,
[root@web ~]# crontab -u skynats -e
Use the command: crontab -u username -l to display the cron jobs for a particular user. For e.g.,
[root@web ~]# crontab -u skynats -l
Cron jobs are an excellent tool for automating repetitive tasks. For instance, we could set up a Cron job to delete temporary files once a week to conserve disc space. To sum up, our Tech Support team offers straightforward setup instructions for DirectAdmin Cron using the aforementioned steps.
Are you looking for an answer to another query? Contact our technical support team.