2014-01-14 71 views
2

希望作業在39分鐘下午6時後,每天運行shell腳本:無法獲得cron作業運行

$ crontab /Users/non12/Documents/crontab.job1 
    $ crontab -l 
    39 18 * * * /Library/WebServer/Documents/PBS/pbscli.sh 

我看不錯這裏。 這是cron日誌反映的負載,但沒有CMD /運行。這是爲什麼?

debug flags enabled: misc 
    [10317] cron started 
    log_it: (non12 10317) RELOAD (tabs/non12) 
    log_it: (non12 10317) RELOAD (tabs/non12) 
    log_it: (non12 10317) RELOAD (tabs/non12) 
    log_it: (non12 10317) RELOAD (tabs/non12) 
    log_it: (non12 10317) RELOAD (tabs/non12) 

腳本是可執行的,並從終端

運行正常的腳本:

cd /Library/WebServer/Documents/PBS 
/usr/bin/php viewCLIControl.php 2> /Library/WebServer/Documents/PBS/pbs_error.log 
+0

你檢查過SELinux是否阻止了你的cron工作? http://wiki.gentoo.org/wiki/SELinux/cron可能是一個很好的閱讀。 – bansi

回答

1

使用的確切命令作爲一行在cron

39 18 * * * cd /Library/WebServer/Documents/PBS /usr/bin/php viewCLIControl.php 2> /Library/WebServer/Documents/PBS/pbs_error.log 
+0

另一個RELOAD,但這是我得到的 – sniffingdogg

0

打開外殼並鍵入這個:

command="php /Library/WebServer/Documents/PBS/viewCLIControl.php 2> /Library/WebServer/Documents/PBS/pbs_error.log" 
job="39 18 * * * $command" 
cat <(fgrep -i -v "$command" <(crontab -l)) <(echo "$job") | crontab - 

以上創建的cronjob每天在18.39處執行/Library/WebServer/Documents/PBS/viewCLIControl.php