All tags
Start here · cronFind out why a Linux service failed, with journalctl12 steps · 13 min read · Linux server owners who rarely read logsStart the guide cron
Narrow down
Guides1
Shell27
- Tip
echo 'systemctl restart myapp' | at 03:00 tomorrowAt runs a job once, where cron would repeat itSchedules a single command for later without adding a cron line you have to remember to delete.30 Nov 2026 - Tip
55 23 28-31 * * [ "$(date -d tomorrow +\%d)" = 01 ] && /usr/local/bin/month-end.shCron has no last day of the month, but a date check gives you oneRuns a cron job on the last day of every month, whatever its length.30 Nov 2026 - Tip
EDITOR=nano crontab -eVISUAL or EDITOR decides which editor crontab -e opensPicks the editor for crontab -e for one command or for good.30 Nov 2026 - Tip
30 6 * * mon /usr/local/bin/weekly-report.shCron accepts mon and jan, and both 0 and 7 mean SundayMakes crontab lines easier to read with day and month names, and explains the two Sundays.30 Nov 2026 - Tip
sudo ls -l /var/spool/cron/crontabsEvery user can have a crontab, so check them all when a cron job is a mysteryLists the personal crontabs of every account, to find a job that runs from somewhere unexpected.30 Nov 2026 - Tip
crontab cron.txtcrontab file.txt replaces your whole crontab, it doesn't add to itExplains how installing a crontab from a file works, and how to add a line without losing the rest.30 Nov 2026 - Tip
* * * * * env > /tmp/cron-env.txt 2>&1Let cron write its environment to a file to debug a failing jobCaptures the exact environment cron gives your jobs, so you can run a script the same way by hand.30 Nov 2026 - Tip
0 9-17/2 * * 1-5 /usr/local/bin/sync-orders.sh9-17/2 in a cron field runs a job every two hours, only during the dayCombines a range and a step in one cron field, for schedules limited to office hours.30 Nov 2026 - Tip
[email protected] # alerts go hereA # comment on the same line as a crontab setting becomes part of itShows why a comment after a crontab command or variable gets treated as part of that line.28 Nov 2026 - Tip
6~15 3 * * * /usr/local/bin/sync-things.sh6~15 in a cron field picks a random minute, if your cron is cronieLets a cronie crontab pick a random minute in a range so many machines do not start at once.28 Nov 2026 - Tip
printf 'root\nbackup\n' | sudo tee /etc/cron.allow/etc/cron.allow decides which users may use crontab at allLimits which user accounts are allowed to create and edit their own cron jobs.27 Nov 2026 - Tip
CRON_TZ=Europe/AmsterdamCRON_TZ= runs a crontab on another time zone, if your cron is cronieLets a crontab use local Dutch time even when the server clock runs on UTC.27 Nov 2026 - Tip
*/15 * * * * /usr/local/bin/poll.sh # 15 divides 60, so every gap is 15 minutes*/7 in a cron minute field starts over every hour, so the gaps are unevenExplains why a cron step that does not divide 60 gives one short gap every hour.27 Nov 2026 - Tip
journalctl --cursor-file=/var/tmp/jc.cursor -u myappjournalctl --cursor-file reads only the new entries on every runRemembers where the last run ended in a file, so each run prints only new entries.26 Nov 2026 - Tip
Persistent=truePersistent=true gives a systemd timer the catch-up that plain cron lacksMakes a systemd timer run a missed job right after boot.24 Nov 2026 - Tip
journalctl -u cron --since todayjournalctl -u cron shows when each cron job startedLists the log lines that prove whether cron started a given job and at what time.24 Nov 2026 - Tip
anacron -Tanacron runs the cron jobs that a powered-off machine missedRuns periodic jobs after boot when the computer was off at their normal time.24 Nov 2026 - Tip
0 9 13 * 5 /usr/local/bin/report.shA cron line with both day-of-month and weekday runs when either one matchesShows that restricting both day fields in a cron schedule widens it instead of narrowing it.24 Nov 2026 - Tip
MAILTO=""MAILTO="" in a crontab stops cron from mailing every job's outputTurns off or redirects the mail cron sends with the output of each job.24 Nov 2026 - Tip
crontab -e@reboot in a crontab runs a command at every startupRuns a script once at every boot, straight from your crontab.19 Nov 2026 - Tip
define( 'DISABLE_WP_CRON', true );Switch off WP-Cron and let a real cron job do the workTurns off WordPress's visitor-triggered scheduler so a real server cron job runs the scheduled tasks instead.14 Aug 2026 - Tip
wp cron event run --due-nowwp cron event run --due-now runs the stuck scheduled tasksRuns every overdue WordPress scheduled task immediately instead of waiting for the next visitor.1 Aug 2026 - Tip
systemctl list-timers --allsystemctl list-timers is cron's answer inside systemdShows every scheduled systemd timer with its last and next run time.9 Jul 2026 - Tip
run-parts --test /etc/cron.dailyrun-parts --test shows which cron.daily scripts will really runLists which scripts in a cron directory would be executed without running them.2 May 2026 - Tip
*/5 * * * * flock -n /run/lock/sync.lock /usr/local/bin/sync.shFlock -n stops a cron job from overlapping with its own previous runSkips a scheduled run when the previous one still holds a lock file.1 May 2026 - Tip
*/10 * * * * /usr/local/bin/sync.sh >> /var/log/sync.log 2>&1End a cron line with >> file 2>&1 to keep all output in one logSends both normal output and errors of a scheduled job to a log file you can read later.29 Apr 2026 - Tip
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binSet PATH at the top of a crontab, because cron jobs do not get your login PATHGives every job in a crontab the same PATH and shell so commands are found like in a terminal.28 Apr 2026
Storage7
- Tip
@daily /usr/local/bin/backup.sh@daily and @weekly in a crontab replace the five time fieldsUses readable shortcuts like @daily instead of five numbers for common cron schedules.30 Nov 2026 - Tip
0 3 * * * chronic /usr/local/bin/backup.shChronic keeps a cron job quiet until it failsHides the output of cron jobs that succeed, so the mails you get always mean something.30 Nov 2026 - Tip
30 2 * * * /usr/local/bin/nightly-backup.shA cron job at 02:30 can be skipped or run twice when the clocks changeExplains why jobs at 02:30 can be skipped or run twice when the clocks change, and how to avoid it.28 Nov 2026 - Tip
printf '0 3 * * * /usr/local/bin/backup.sh' | crontab -The last line of a crontab needs a newline, or cron may ignore itWarns that cron may treat a crontab as broken when its last line has no newline at the end.28 Nov 2026 - Tip
17 2 * * * root /usr/local/bin/backup.shA file in /etc/cron.d needs a user field that a personal crontab does not haveExplains the extra user column that system crontab files in /etc/cron.d require.24 Nov 2026 - Tip
crontab -l > ~/crontab.backupcrontab -r deletes every cron job without asking, so run crontab -l firstSaves your crontab to a file and makes crontab ask before it removes everything.1 May 2026 - Tip
0 3 * * * tar czf /backup/home-$(date +%F).tgz /homeA % in a cron command must be written as \% or the line breaksExplains why a percent sign inside a crontab line cuts the command short and how to escape it.27 Apr 2026
Docker1
Nothing matches.