o
Cronjob.de › Crontab reference › Weekdays
For "weekdays at 8 am" the expression is 0 8 * * 1-5. The last field is the day of the week, and 1-5 means Monday to Friday.
Meaning
The days of the week are numbered: 1 is Monday, 5 is Friday, 6 is Saturday. Sunday has two numbers, 0 and 7, both are allowed. Instead of numbers many schedulers also accept names such as MON-FRI.
The first two fields set the time, here 8:00. Day of month and month stay *. The job therefore runs five times a week.
The next runs
Calculated in German time when this page was loaded.
Variants
*/15 8-18 * * 1-5 |
Every 15 minutes during office hours, Monday to Friday. | Adjust |
0 8 * * 1 |
Mondays only at 8 am, for example for a weekly report. | Adjust |
0 17 * * 5 |
Fridays at 5 pm, to close the week. | Adjust |
0 10 * * 6,0 |
The opposite: weekends only, Saturday and Sunday at 10 am. | Adjust |
0 8 * * 1,3,5 |
Monday, Wednesday and Friday. | Adjust |
Watch out for
To cron, weekdays means Monday to Friday, even on Whit Monday or 24 December. If nothing should happen on holidays, the script itself has to check whether today is one and stop right away.
Unix has a special rule: if both fields hold values, it is enough for one of them to match. 0 8 1 * 1 runs there on the 1st of every month AND on every Monday, not only on the 1st when it is a Monday. At Cronjob.de it is the other way round: both have to match. Anyone copying a schedule from a crontab should know this.
In some programming languages the week starts differently or counts from 1 for Sunday. In the crontab it is always: 0 or 7 Sunday, 1 Monday.
Own server
Open with crontab -e and add one line. The first starts a PHP script directly, the second calls an address. Replace paths and address with your own.
0 8 * * 1-5 /usr/bin/php /pfad/zu/skript.php >/dev/null 2>&1
0 8 * * MON-FRI curl -fsS https://ihre-domain.de/cron.php >/dev/null
Without your own server
No command-line access needed: you enter the address of your script and click the schedule together. You can also type the expression above directly, or describe the interval in one sentence and have it suggested. Cronjob.de uses German time.
Five cronjobs are free forever, on the five-minute grid. One-minute intervals start with Plus. How to prepare a script on shared web space for this is explained in the web space guide.
FAQ
5-7 for Friday to Sunday work.0 8 * * 1 and check in the script whether the day is the 7th or earlier. At Cronjob.de 0 8 1-7 * 1 is enough, because both fields have to match there.Create an account, enter the address, click the schedule. Five cronjobs are free forever, the first 14 days run on the Unlimited plan.
Start for free To the crontab generator