21+ years in hosting · Jaipur, India · INR billing with 18% GST · 24/7 email support
Blog · WebJi® India

Crontab examples for Linux

Quick answer

A Linux crontab line is five time fields (minute, hour, day of month, month, weekday) followed by the command. For example, */15 * * * * /usr/bin/php /home/user/cron.php runs that PHP file every 15 minutes. Add lines with crontab -e, use full paths, and redirect output to a log file.

For server and hosting users scheduling scripts, backups or WordPress tasks who want lines that work the first time.

✓ In business since 2005
✓ INR + GST billing
✓ 24/7 Email Support — avg reply < 60 min
GuideWebJi®
knowledge
Read time
7 min
Sections
7
Updated
14 Nov 2026
Written by
WebJi® team

What do the five Linux crontab fields mean?

A Linux crontab line has five time fields (minute, hour, day of month, month, weekday) followed by the command. Crond compares those fields with the server clock once a minute and runs the command when they match. There is no seconds field on a normal user crontab.

What do the five Linux crontab fields mean?
FieldAllowed valuesA star means
Minute0–59Every minute
Hour0–23Every hour
Day of month1–31Every date
Month1–12, or jan–decEvery month
Weekday0–7 (0 and 7 are Sunday)Every day of the week

The star means every allowed value in that field. A comma lists values, so 8,20 in the hour field is 08:00 and 20:00. A hyphen is a range, so 1-5 in the weekday field is Monday through Friday. A slash is a step: */15 in the minute field is minute 0, 15, 30, and 45.

Month and weekday fields also accept names, such as jan or mon. Sunday is 0 or 7. Monday is 1 and Saturday is 6. The clock is the server clock. If date prints UTC, 02:00 in the crontab is 07:30 IST. cronie, the cron on AlmaLinux, Rocky and Fedora, documents a CRON_TZ=Asia/Kolkata line that makes the entries below it use IST; check man 5 crontab on Debian or Ubuntu before relying on it there.

If both the day-of-month and the weekday are restricted, Vixie cron and cronie run the job when either field matches. The line 0 6 1 * 1 runs at 06:00 on the 1st and also on every Monday. A star in either field turns that rule off.

Those five fields are the same schedule described in what a cron job is. The lines below are the ones you paste.

Which crontab examples run every few minutes?

Every-few-minutes jobs use a step in the minute field, such as */5 or */15. Short intervals belong in the minute field. A star in every field runs every minute, which is rarely what a website needs. A step or a list is the usual line.

Which crontab examples run every few minutes?
Crontab lineWhen it runs
* * * * * /usr/bin/php /home/user/cron.phpEvery minute
*/5 * * * * /usr/bin/php /home/user/cron.phpEvery 5 minutes
*/15 * * * * /usr/bin/php /home/user/cron.phpEvery 15 minutes
*/30 * * * * /usr/bin/php /home/user/cron.phpEvery 30 minutes, at :00 and :30
0 * * * * /usr/bin/php /home/user/cron.phpMinute 0 of every hour
15 * * * * /usr/bin/php /home/user/cron.php15 minutes past every hour
0 9-17 * * 1-5 /usr/bin/php /home/user/cron.phpMinute 0, from 09:00 through 17:00, Monday to Friday

0 9-17 * * 1-5 is not a job that stays running from 09:00 to 17:00. It starts once at minute 0 of each of those hours, Monday to Friday, and then exits. Put the long work inside the script.

Use the full path to the program. php alone is resolved with cron's PATH, which is often only /usr/bin:/bin, so the shell you use when logged in can find a binary that cron cannot.

Which crontab examples run daily, weekly, or monthly?

Daily, weekly and monthly jobs fix the minute and hour, then restrict the weekday or day of month. They use the same five fields. Set the hour and the day, and leave the minute at 0 unless the job needs a different minute.

Which crontab examples run daily, weekly, or monthly?
Crontab lineWhen it runs
15 3 * * * /home/user/scripts/backup.sh03:15 every day
30 0 * * * /usr/local/bin/cleanup.sh00:30 every day
0 8,20 * * * /home/user/scripts/sync.sh08:00 and 20:00 every day
0 2 * * 6 /home/user/scripts/weekly.shSaturday at 02:00
0 4 * * 0 /home/user/scripts/report.shSunday at 04:00
0 1 1 * * /home/user/scripts/monthly.sh01:00 on the 1st of the month
0 0 1 1 * /home/user/scripts/yearly.sh00:00 on 1 January

A backup that only copies files is not a restore test. After the 03:15 job, check that the archive exists and that the disk still has room. The checks for free disk space on a Linux server are the next step when the dump grows every night.

A job does not run late if the server was off at that minute. The next matching minute is the next chance. The @reboot shortcut below is the boot case, not a catch-up for a missed 03:15.

What do @daily and @reboot mean in crontab?

@daily means midnight (0 0 * * *) and @reboot means once when cron starts after a boot. Shortcuts replace the five fields; they do not change the command. @daily is midnight, which is 0 0 * * *, and @hourly is minute 0 of every hour.

What do @daily and @reboot mean in crontab?
ShortcutSame as
@rebootOnce when crond starts after boot
@yearly or @annually0 0 1 1 *
@monthly0 0 1 * *
@weekly0 0 * * 0 (Sunday)
@daily or @midnight0 0 * * *
@hourly0 * * * *

@reboot runs once per boot. It does not repeat, and it does not replay a schedule the machine missed while it was down. On a shared hosting account, test it, because some panels never fire @reboot.

Cron is not a retired tool. systemd timers are a separate scheduler with their own unit files. A user crontab is still the file crontab -e edits.

Crontab example for WordPress: replacing WP-Cron

To run WordPress scheduled tasks from real cron, set DISABLE_WP_CRON in wp-config.php and call wp-cron.php from a crontab line every 5 or 15 minutes. By default WordPress only checks its schedule when someone visits, so a quiet site runs scheduled posts and backups late, and a busy one checks on many page loads.

# wp-config.php, above the "stop editing" line
define( 'DISABLE_WP_CRON', true );

# crontab -e
*/15 * * * * /usr/bin/php /home/user/public_html/wp-cron.php >/dev/null 2>&1
# or, with WP-CLI installed:
*/15 * * * * /usr/local/bin/wp cron event run --due-now --path=/home/user/public_html >/dev/null 2>&1

Check the path with command -v wp before pasting the second line. Run either command once by hand first; an error there will also fail in cron.

How do you log or email crontab output?

Redirect output to a log file with >> file 2>&1, or set MAILTO to receive it by email. Cron mails the command's standard output and standard error to the crontab user unless you redirect them. An empty mailbox means the command printed nothing. It does not mean the command succeeded.

Append output with /home/user/scripts/backup.sh >> /home/user/logs/cron.log 2>&1. Create the logs directory first. A missing directory makes the redirect fail before the script runs.

MAILTO=you@example.com on its own line sends that mail to another address, if the server can deliver mail. An empty MAILTO= drops the mail for every job in that file. Set the empty value only when the log file is already in place.

On a VPS, the daemon's own line is separate from the script log. Debian and Ubuntu write it to /var/log/syslog. AlmaLinux and other cronie systems use /var/log/cron.

journalctl -u cron or journalctl -u crond shows the same start line. That line proves crond launched the command. It does not prove the script finished.

Why does a Linux crontab job fail with no mail?

A crontab job usually fails silently because cron's environment is smaller than your login shell: a short PATH, /bin/sh and no profile. The usual default PATH is /usr/bin:/bin and the usual shell is /bin/sh, not bash.

Find the binary while logged in with command -v php or command -v python3, then paste that path into the crontab. A relative path such as scripts/backup.sh depends on the current directory, which cron does not set to your home in a reliable way.

$HOME is set. A leading tilde is not expanded in every cron. Write /home/user/scripts/backup.sh instead of a short name.

The script must be executable by the user who owns the crontab, and it must use Unix line endings. A permission denied line in the mail is the script or the directory, not the five time fields.

An unescaped percent sign in the command is special. Cron turns the first % into a newline and sends the rest to the command as input. Write date +\%Y-\%m-\%d or the format never reaches date.

A job longer than its gap can start a second copy. flock -n /tmp/backup.lock /home/user/scripts/backup.sh skips the new start while the lock is held.

If the mail is still unclear, email support@webji.services. The desk replies in Hindi and English, and the average first reply is under 60 minutes. The office phone is not a support line.

How do you list, edit, or remove a crontab?

List with crontab -l, edit with crontab -e, and remove one job by deleting its line rather than running crontab -r. crontab -l prints the current user's file. If the reply is no crontab for that user, nothing is scheduled yet. crontab -e opens the editor and installs the file when you save. The success line is crontab: installing new crontab.

  1. Run crontab -l and copy the file somewhere before you edit it.
  2. Run crontab -e, add one line, and save.
  3. Run crontab -l again and confirm the new line is the only change.
  4. Wait for the next matching minute and read the log or the mail.
  5. To drop one job, open crontab -e and delete that line. crontab -r removes the whole file. crontab -i asks before that delete.

crontab -u username -l lists another user's file. You need permission for that user. Root can do it. A normal hosting user cannot read someone else's crontab.

The daemon has to be running. On Debian and Ubuntu the unit is cron. On AlmaLinux and Rocky it is crond. systemctl status cron or systemctl status crond shows active or inactive. A stopped daemon means no line will fire.

On Linux hosting with SSH, this is the file you edit. A cPanel account stores the same five fields under Advanced, then Cron Jobs.

FAQ

Frequently asked questions

What does */15 * * * * mean?

It runs every 15 minutes, at minute 0, 15, 30, and 45 of every hour. The slash is a step in the minute field. The other four stars mean every hour, every date, every month, and every weekday.

How do I run a cron job every 30 minutes?

Use */30 * * * * and then the command. That starts at minute 0 and minute 30 of every hour. 0,30 * * * * is the same two minutes written as a list.

How do I run a job every day at midnight?

Use 0 0 * * * and the command, or the shortcut @daily. Both mean midnight on the server clock. If date shows UTC, that midnight is 05:30 IST, not midnight in India.

What does @reboot mean in crontab?

@reboot runs the command once when crond starts after a boot. It is not a daily schedule, and it does not rerun a job the server missed while it was off. On shared hosting, confirm the panel actually fires it.

Where are Linux cron logs?

Script output goes to mail, or to the file you added with a redirect. The daemon start line is in /var/log/syslog on Debian and Ubuntu, and in /var/log/cron on cronie systems such as AlmaLinux.

How do I delete one crontab line without removing the rest?

Run crontab -e and delete only that line, then save. crontab -r deletes every line in the file. crontab -i asks you to confirm before that full delete.

Last editorial update: 14 November 2026.

WebJi® since 2005

Ready to get started with WebJi®?

Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.