Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To run an existing check once a day on Linux, add it to your user crontab with crontab -e. For example, this runs a script every day at 2:00 a.m. and appends its output and errors to a log:

0 2 * * * /absolute/path/to/verify.sh >> /absolute/path/to/verify.log 2>&1

Replace verify.sh with the command that checks the item you want verified, and replace both paths with real absolute paths. The schedule runs according to the host’s cron time settings; the line alone does not confirm that the check succeeds.

What the cron schedule means

A standard cron entry has five time fields followed by the command: minute, hour, day of month, month, and day of week. In 0 2 * * *, the first two fields mean minute zero of hour two, and the asterisks mean every day, month, and weekday. The Debian bookworm crontab(5) manual gives 5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1 as an example that runs five minutes after midnight every day; cron variants can differ in details. Debian bookworm crontab(5) manual.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The time is interpreted using the host’s cron and timezone configuration. Check the server’s timezone before choosing an hour. Cronie documents behavior around daylight-saving clock changes, including skipped or repeated local times; Debian’s systemd-cron documentation also describes limitations on per-user timezone behavior. Cronie crontab(5).

How to add and verify the job

  1. Identify the real check. Determine its exact command and what counts as success or failure. The example uses a placeholder; it cannot define what you need to verify.
  2. Run it manually as the intended account. Confirm that it works and note the expected result. Use absolute paths for the command, script, and any files it needs, since a scheduled job may not run with the same environment as an interactive terminal.
  3. Edit the account’s crontab. Run crontab -e, then add the daily schedule, substituting the actual script and log locations:
    0 2 * * * /absolute/path/to/verify.sh >> /absolute/path/to/verify.log 2>&1

    Choose an hour that fits the host’s timezone and workload. The user crontab runs jobs as its owner. System-wide crontab files commonly include an additional username field, so do not paste a user-crontab line into one without checking its format. Debian bookworm crontab(5) manual.

  4. Save and review. Run crontab -l to confirm the entry is present. Ensure the script is executable if you are invoking it directly.
  5. Check the first scheduled run. After the next scheduled time, inspect the log and confirm the check’s expected success or failure result. If there is no output in the file, consult the host’s cron logs or journal; locations and service details depend on the Linux distribution.

How output and errors are recorded

In the example, >> appends standard output to the log file, while 2>&1 sends standard error to the same destination. Make sure the account running the job can write to the log’s directory. Cron may also mail job output when mail is configured, and some daemon configurations send output to syslog. Check how the target host handles output rather than assuming one logging method applies everywhere. Linux cron(8) manual.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When a systemd timer may fit better

A user crontab is a straightforward choice for an ordinary daily command. If the host already manages scheduled work through systemd and you want to inspect timer and service units, consider a systemd timer instead. Oracle Linux 9 documents these commands for listing and inspecting timer units:

systemctl list-unit-files --type=timer
systemctl cat name.timer

Replace name.timer with the timer unit’s actual name. Whether a timer runs a job missed while the machine was off depends on its configuration; do not assume it catches up without checking the relevant timer settings. Oracle Linux 9: Automating System Tasks With cron.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick run-verification checklist

  • The command works manually under the account that will own the crontab.
  • The schedule uses the intended host timezone and hour.
  • The saved entry appears in crontab -l.
  • The script and log paths are absolute, and the job can execute the script and write to the log.
  • After the first scheduled run, the log or applicable system logs show that the check ran and produced the expected result.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.