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

879 B

Crontab

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

TL;DR

# List existing jobs.
crontab -l
sudo crontab -l -u 'jane'

# Edit crontab files.
crontab -e
sudo crontab -e -u 'mark'

# Replace the current crontab with the contents of a given file.
crontab 'path/to/file'
sudo crontab -u 'kelly' 'path/to/file'

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

# Remove all cron jobs.
crontab -r
sudo crontab -r -u 'nana'
# Run 'pwd' every day at 10PM.
0 22 * * * pwd

# Run 'ls' every 10 minutes.
*/10 * * * * ls

# Run a script at 02:34 every Friday.
34 2 * * Fri /absolute/path/to/script.sh

Further readings

Sources