Python脚本与Cron作业

Dan*_*oss 2 python cron archlinux

我需要运行一个cron作业,以便在每个星期一早上的"00:00:00"UTC每周生成一个用户排名列表.有没有人为此得到一个例子,它真的是我的头...我看着"crontab -e"并立即迷失了.

Basics:
 - Run the script, eg: /srv/django/get_rankings.py
 - Run the script at "00:00:00" and "00:05:00" every Monday.
 - Run the same script the next Monday ... and repeat
Run Code Online (Sandbox Code Playgroud)

我在Linux Arch上,任何抬头都会很棒.

非常感谢,希望一切顺利

ava*_*sal 5

crontab把条目放进去,

00,05 0 * * 1 /srv/django/get_rankings.py
Run Code Online (Sandbox Code Playgroud)

每个月的每个星期一00.00和00.05运行脚本

*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)
Run Code Online (Sandbox Code Playgroud)

*在上面的值字段中表示该列的大括号中的所有合法值.值列可以包含*由逗号分隔的元素或列表.

元素可以是上面显示的范围中的数字,也可以是用连字符分隔的范围内的两个数字(表示包含范围)