Green YGreck Guides FR
🐧 LinuxIntermediate⏱ 10 min6 steps

Schedule tasks with cron

Run a script at a fixed time, with no interface.

  1. Edit your cron table:
    crontab -e
  2. Each line follows the format: minute, hour, day of month, month, day of week, command.
  3. Examples: every 15 minutes, and every day at 3:30 am:
    */15 * * * * /home/moi/scripts/sync.sh
    30 3 * * * /home/moi/scripts/sauvegarde.sh
  4. List your tasks:
    crontab -l
  5. Always use absolute paths and redirect output to a file to debug.
  6. Modern alternative: systemd timers, more flexible for services.