我运行cronjob时出现问题。没有经验,所以可能会监督一些不知名的东西。下面的脚本作品就像一个魅力(所有旧过滤器从数据库中删除)从shell中运行时:cronjob未执行
[email protected]:~> /usr/bin/env /home/dude/RubyOnRails/myproject/script/rails runner /home/dude/RubyOnRails/myproject/script/delete_old_filters.rb
我使用chmod作出的可执行脚本。现在,我想这是经常使用一个cronjob运行:
[email protected]:~> crontab -e
这个文件是空的,我把这个在一行:
* * * * * /usr/bin/env /home/dude/RubyOnRails/myproject/script/rails runner /home/dude/RubyOnRails/myproject/script/delete_old_filters.rb
我希望脚本运行的每一分钟,但没有发生。在/etc/cron.deny中,只提到'guest',而/ etc/allow不存在。重新启动我的系统也没有帮助。
在crontab似乎proberly更新:
[email protected]:~> crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.f9Et2M installed on Thu May 3 14:04:47 2012)
# (Cronie version 4.2)
* * * * * /usr/bin/env /home/dude/RubyOnRails/myproject/script/rails runner /home/dude/RubyOnRails/myproject/script/delete_old_filters.rb
但我希望在这里一点也:
[email protected]:~> atq
[email protected]:~>
的的cronjob做一些事情。每分钟将一个条目添加到/var/log/cron.log:
2012-05-03T15:27:01+02:00 linux /USR/SBIN/CRON[5276]: (dude) CMD (/usr/bin/env /home/dude/RubyOnRails/myproject/script/rails runner /home/dude/RubyOnRails/myproject/script/delete_old_filters.rb)
问题是,作业未执行。它应该从数据库中删除一些记录,但它不会。手动运行相同的脚本就可以做到这一点。
有人看到我错过的(也许是微不足道的)事情吗?
究竟是什么问题?该操作未执行或您没有在屏幕上看到它?由于crontab操作在后台运行。 –
感谢您的回复,并感到抱歉,因为不清楚。我编辑了这个问题(问题在于它没有执行,不需要在屏幕上看到它)。 – Jos
你检查过cron日志吗?你需要先激活它(例如使用debian:http://happy-coding.com/enable-crontab-logging-in-debian-linux/) – High6