How do I set up a cronjob through DirectAdmin?
Back to web hostingIt can be convenient to perform certain tasks at fixed times, for this you can set up a cronjob.
For example, you can set it to periodically empty the cache or to call a PHP function at a specified time.
In this tutorial, we will explain how to set up a cronjob in DirectAdmin, after which we will also explain what the different settings mean.
- Log in to the hosting of the domain name in question.
- Under "Advanced Features," navigate to "Cronjobs."
- Click here on "Add cronjob."
- In the next window, you can specify the desired settings.
We will elaborate on these settings below. - After these settings have been made, a choice can be made as to whether emails in response to this cron should be prevented.
If no mails should be sent click on "Prevent mails", this adds a small piece of code to the command that prevents mails from being sent. - When all settings have been entered you can click on "Create".
You will now be returned to the page with the other cronjobs.
Should you wish to make a change you can click on the pencil next to the cronjob to update it.
What settings should I use?
A cronjob is executed based on Minutes, Hours, Days, Months and days of the week.
You can also enter a "*" and it will be executed on every minute, hour, day, month, or day of the week.
- Minutes: This will be executed on the minute indicated, for example if you enter 30 it will be executed on the 30th minute of the hour.
- Hour: This will be executed at the hour indicated, for example 19 can be entered here to have it executed at the? 19th hour.
- Day of the month: Here the day of the month is asked, so you can execute a cronjob on every 20th of the month.
- Month: Here the month is requested. Thus 6 can be entered here to execute the job every June.
- Day of the week: Here the day of the week can be specified, for example, if 6 is entered here it will be executed on Saturday.
With the above examples, if the assignment falls on a Saturday (this is because of the day of the week) on June 20, it will be executed at 19:30.
Command: This is the command that can be executed on the server. It allows you to call a .php file, for example, or delete files on the server.
Back to web hosting