Syntax:

# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed

Usage:

# 指定编辑器
crawler$ echo 'export EDITOR="vi"' >> ~/.bashrc
crawler$ source ~/.bashrc

# 列出所有定时任务
crawler$ crontab -l [-u USER_NAME]

# 添加定时任务(文件名以 'cron' 结尾)
crawler$ cat crawlercron
  # 每 30 分钟执行一次
  # 30 * * * * source /path/to/project/env/bin/active && python /path/to/project/manage.py runcron
crawler$ crontab crawlercron

# 清空定时任务
crawler$ crontab -r [-u USER_NAME]

Examples:

# minute    hour    day    month    dayofweek    command

# 每分钟
  *         *       *      *        *            service nginx restart
  */1       *       *      *        *            service nginx restart

# 每小时
  *         */1     *      *        *            service nginx restart

# 每天 23:00-03:00 的每小时
  *         23-3/1  *      *        *            service nginx restart

# 每天 10:24
  24        10      *      *        *            service nginx restart

# 每周末 10:24
  24        10      *      *        0            service nginx restart

# 每月 1 号的 10:24
  24        10      1      *        *            service nginx restart

# 每年 1 月 1 号的 10:24
  24        10      1      1        *            service nginx restart