1

我有一个.sh带有命令的脚本:

curl --digest "http://xxxxxxx.xxx/mail.php?email=xxxx@xxx.xx";

从终端这很好用:

./script.sh #(mail arrives in my box)

从 php 这很好用:

shell_exec('./phpsc.sh');  // (mail arrives in my box) 

从终端这很好用:

 at -f phpsc.sh now + 5 minute 
 # (job created, mail arrives in my box after 5 minutes)

从 php 这将不起作用:

shell_exec('at -f phpsc.sh now + 5 minute'); //:( :(

即使我将at命令放入脚本并从 php 运行脚本,该at命令也会被忽略:(

4

3 回答 3

2

我找到了解决方案,

我从 /etc/at.deny 中删除了www -data ,现在 'at' comand在 php (sell_exec) 中工作正常

于 2016-06-10T00:55:41.580 回答
0

我知道有时需要使用它source来调用环境变量。

以外的其他东西,请调整):

shell_exec('source ${HOME}/.kshrc ; at -f phpsc.sh now + 5 minute'); 
于 2016-06-09T15:30:05.213 回答
0

在 CentOS 7 中,我必须在 /etc/at.allow 中添加“apache”。

于 2017-03-13T08:32:20.050 回答