0

我编辑了我的 crontab,但旧设置仍然运行。这是我的 crontab 清单:

[root@semanticvalley etc]# for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
no crontab for root
no crontab for bin
no crontab for daemon
no crontab for adm
no crontab for lp
no crontab for sync
no crontab for shutdown
no crontab for halt
no crontab for mail
no crontab for news
no crontab for uucp
no crontab for operator
no crontab for games
no crontab for gopher
no crontab for ftp
no crontab for nobody
no crontab for dbus
no crontab for vcsa
no crontab for mailnull
no crontab for smmsp
no crontab for sshd
no crontab for apache
## ----- Begin HSPC generated text. Do not edit! ----- another_site.com
## ----- End HSPC generated text. ----- another_site.com

MAILTO=''
## ----- Begin HSPC generated text. Do not edit! ----- comehike.com
MAILTO='alex.genadinik@gmail.com'
30 13 * * * php /home/webadmin/comehike.com/html/utils/post_hike.php
## ----- End HSPC generated text. ----- comehike.com

MAILTO=''
no crontab for rpc
no crontab for popa3d
no crontab for pcap
no crontab for nscd
no crontab for rpm
no crontab for named
no crontab for mysql
no crontab for xfs
no crontab for spfmilt
no crontab for genadinik
## ----- Begin HSPC generated text. Do not edit! ----- somesite.com
## ----- End HSPC generated text. ----- somesite.com

但是我为其设置新 crontab 的站点甚至没有出现在此列表中。我必须更改/编辑什么才能正确设置?

澄清一下,这是旧的 crontab:

MAILTO=''
## ----- Begin HSPC generated text. Do not edit! ----- comehike.com
MAILTO='alex.genadinik@gmail.com'
30 13 * * * php /home/webadmin/some_url/some_path.php
## ----- End HSPC generated text. ----- comehike.com

我设置的新 crontab 甚至没有出现在这里。但是,如果我执行 cat /etc/crontab ,那么新设置就会出现。

谢谢!

4

1 回答 1

3

编辑 crontab 的正确方法是:

crontab -e

如果您想从 shell 或用户脚本中执行此操作,您还可以执行以下操作:

less setting_file | crontab -u user

其中 setting_file 是包含新设置的文件。我希望这会有所帮助。

于 2012-12-30T03:54:42.630 回答