【发布时间】:2011-11-17 16:49:09
【问题描述】:
我有一个 Debian VPS,上面有几个网站。我目前正在大量使用 django。
我想要一个 cron 作业在我的一个 django 站点中运行和安排一个脚本。结果是我无法让 Cron 作业运行,而且我不确定如何对其进行排序,因为我没有很多 Linux 经验。
我的 /etc/crontab 文件
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
HOME=/home/shofty
LOGNAME=shofty
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO="info@webbricks.co.uk"
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
所以我已经在“crontab -e”中设置了工作
50 10 * * * /home/shofty/virtualenvs/webbricks/bin/chronograph -e /home/shofty/virrtualenvs/webbricks/bin/activate_this.py -p /home/shofty/virtualenvs/webbricks
但它似乎在我尝试的时间没有运行(10:50 是任意的,我每隔几分钟调整一次以使其在更改设置或其他设置后运行)。
我认为 cron 正在运行,因为我可以做到
/etc/init.d/cron stop
但是带有 start 的相同命令失败。显然在让它再次运行之后开始。 从我读过的所有内容来看,ps aux 的输出暗示它正在运行。
root@shoftys - server>_ /home/shofty# ps aux | grep cron
root 19106 0.0 0.0 18548 948 ? Ss 10:42 0:00 /usr/sbin/cron
root 27130 0.0 0.0 3876 600 pts/0 S+ 15:52 0:00 grep cron
我在 crontab 的命令中添加了 > /home/shofty/virtualenvs/webbricks/cron.log,但它似乎不想输出日志文件。 我在 /var/log/cron 中什么也没有得到,它只是说它是一个新文件。
作为一个菜鸟,我有点不确定下一步该去哪里,请对 linux、debian 和 cron 有更多了解的人建议下一步该去哪里?
【问题讨论】:
-
在用 sillyMunky 进行了相当多的检查之后,这归结为没有运行该作业的权限。通过尝试手动运行作业发现了它。不知道为什么我没有权限,但认为这值得一个新问题。