Files
oam/knowledge base/cron.md
2024-06-12 21:46:29 +02:00

1.3 KiB

Cron

  1. TL;DR
  2. Further readings
    1. Sources

TL;DR

Files in /etc/cron.hourly and similar must:

  • Be scripts.
    Normal crontab files will error out.
  • Be executable.
    If not executable, execution will silently fail.
  • Match the Debian cron script namespace (^[a-zA-Z0-9_-]+$).
    Files with an extension won't work.
systemctl --enable --now 'crond.service'
journalctl -xefu 'crond.service'

# Validate crontab files.
crontab -T '/etc/cron.d/prometheus-backup'

# List files in given directories.
# Kinda… useless?
run-parts --list '/etc/cron.daily'

# Print the names of the scripts which would be invoked.
# '--report' is *not* available everywhere.
run-parts --report --test '/etc/cron.hourly'

# Manually run crontab files in given directories.
run-parts '/etc/cron.weekly'

Further readings

Sources