Cron

Cron is a time-based scheduler for *nix systems. It allows you to run programs and commands automatically at specified times.

Scheduling Tasks

  1. Connect to your seedbox through SSH
  2. Open your crontab file crontab -e
  3. Enter the jobs you want to schedule in the editor (one per line)
  4. Hit Ctrl-x to exit. Press Y then Enter to save changes.

Job Syntax

The format for crontab entries is * * * * * command

From left to right, each field means:

FieldMeaning
1Minute (0-59)
2Hour (0-23)
3Day of month (1-31)
4Month (1-12, Jan, Feb, ...)
5Day of week (0-7) 0,7=Sunday, 1=Monday ...
or Sun, Mon, Tue, Wed, Thur, Fri
6Command to execute
  • A comma is used to specify a list of values (1,3,5)
  • A dash is used to specify a range of values (1-5 means 1,2,3,4,5)
  • A slash is used to skip the given number of values (*/12 means "every 12")
  • An asterisk is used to specify all values

Example: 0 12 * * * command would run the specified command every day at noon

Here are some handy aliases to replace the time fields for common cases:

ShortcutMeaning
@rebootRun once after reboot
@yearly
@annually
Run once a year (0 0 1 1 *)
@monthlyRun once a month (0 0 1 * *)
@weeklyRun once a week (0 0 * * 0)
@dailyRun once a day (0 0 * * *)
@hourlyRun once an hour (0 * * * *)

Example: @reboot command will run the specified command if your server is restarted