cron的格式如下:
# Minute Hour Day of Month Month Day of Week Command
# (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat)
Run Code Online (Sandbox Code Playgroud)
例如,每天早上9点运行并连接到站点的cron看起来像这样:
0 9 * * * wget --spider http://www.stackoverflow.com > /dev/null 2>&1
Run Code Online (Sandbox Code Playgroud)
运行crontab -e
以编辑crontab,将此行添加到其中并保存.