【发布时间】:2015-05-23 19:52:23
【问题描述】:
我有这个 scipt:
#!/bin/bash
while true
do
if [ -f /opt/command/command.txt ]; then
chmod 777 /opt/command/command.txt
rm /opt/command/command.txt
reboot
fi
done
在我的 crontab 中我有:
@reboot sh /root/reboot.sh
并且文件是用这个 php 代码创建的:
$fh = fopen("/opt/command/command.txt", 'w');
fwrite($fh, "reboot");
fclose($fh);
所以如果我手动运行sh reboot.sh,则此代码有效。
但是在 crontab 中,什么也没有发生。
我做错了什么?
【问题讨论】:
-
crontab 运行脚本时是否设置了
PATH(echo $PATH)? -
@Sverri:你应该停止在 cmets 中发布其他人的答案。
-
@cari 你看到我评论末尾的问号了吗?上次我检查,答案没有问号...
标签: php shell cron debian crontab