Python脚本与Cron作业

Python脚本与Cron作业,python,cron,archlinux,Python,Cron,Archlinux,我需要运行一个cron作业,以便每周在UTC每周一早上的“00:00:00”生成一个用户排名列表。有人举过这样的例子吗,它真的让我头疼。。。我看了看“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 Monda

我需要运行一个cron作业,以便每周在UTC每周一早上的“00:00:00”生成一个用户排名列表。有人举过这样的例子吗,它真的让我头疼。。。我看了看“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
我在Linux Arch上,任何提示都会令人惊讶

非常感谢,
希望一切顺利

crontab-e
,并插入以下内容:

0 0 * * 1 /srv/django/get_rankings.py
0 5 * * 1 /srv/django/get_rankings.py
0 0
是午夜<代码>05是凌晨5点<代码>1是星期一。这两颗星的意思是“我不在乎日期”。这是一个很好的参考

你可以说“0点或5点”,把所有的信息放在一行:


crontab放入条目,如

00,05 0 * * 1 /srv/django/get_rankings.py
在每个月的每个星期一的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)
上述值字段中的
*
表示该列大括号中的所有合法值。 “值”列可以有一个
*
或由逗号分隔的元素列表


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

这是Arch Linux,最好的Linux发行版。Yeh,我刚写下要更新的内容,但我就有一包水果味。谢谢Blender。谢谢avasal,这是完美的,立刻就有意义了。很好的解释。。。我来试试看。
*     *     *   *    *        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)