One-shot job with at

Schedule a single deferred command; inspect queue with atq, cancel with atrm

at now + 1 hour <<< 'systemctl restart nginx'

tool
cron8 commands
tags
crontroubleshooting

More cron commands

  • batch <<< '/opt/heavy-reindex.sh'

    Run only when load avg drops below 1.5; note: atd must be running

  • crontab -l -u <name> 2>/dev/null || echo 'no crontab'

    Inspect a service account's jobs as root; note: -u needs root or sudo

  • ( crontab -l 2>/dev/null; echo '@reboot /usr/local/bin/warmup.sh' ) | crontab -

    Append @reboot job idempotently; note: no networking guarantee at boot, use systemd for deps

  • */5 * * * * /opt/job.sh 2>&1 | /usr/bin/logger -t job

    Tag stdout+stderr into journald/syslog instead of mailing root

  • crontab - <<'EOF' MAILTO=ops@example.com PATH=/usr/local/bin:/usr/bin:/bin 0 3 * * * backup.sh EOF

    Cron PATH is minimal; set PATH/MAILTO at top or jobs fail silently

all 8 cron commands