Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将wget与shell_exec和at命令一起使用?_Php_Linux_Wget_Shell Exec_At Job - Fatal编程技术网

Php 将wget与shell_exec和at命令一起使用?

Php 将wget与shell_exec和at命令一起使用?,php,linux,wget,shell-exec,at-job,Php,Linux,Wget,Shell Exec,At Job,两天来,我一直在努力使用shell_exec PHP函数和at-linux命令。 简而言之,这是可行的: shell_exec('/usr/bin/at 09:32 <<EOF touch /var/www/website/hello.txt EOF' ); 这并不是: shell_exec('/usr/bin/at 09:32 <<EOF wget -O - -q -t 1 "http://192.168.56.101/website/t

两天来,我一直在努力使用shell_exec PHP函数和at-linux命令。 简而言之,这是可行的:

shell_exec('/usr/bin/at 09:32 <<EOF
       touch /var/www/website/hello.txt 
EOF'
);
这并不是:

shell_exec('/usr/bin/at 09:32 <<EOF
       wget -O - -q -t 1 "http://192.168.56.101/website/test.php?param=hello" >/dev/null 2>&1
EOF'

);
为什么?

注意:上面的代码在控制台中不起作用


提前谢谢。

好的,我终于拿到了

对于那些感兴趣的人来说,pb指出wget命令也需要使用完整路径ie:/usr/bin/wget来调用。 误导我的是触摸命令不需要它。这很奇怪,但不管怎么说,下面是工作代码:

shell_exec('/usr/bin/at 09:32 <<EOF
       /usr/bin/wget -O - -q -t 1 "http://192.168.56.101/website/test.php?param=hello" >/dev/null 2>&1
EOF'
);

使用而不是wget。和cron而不是at。壳牌执行官应该被视为有害的,在一般情况下是最后的手段。这项工作最终会在吗?system_exec调用的返回值是多少?谢谢,但是我应该如何在shell_exec中使用file_get_内容?是的,作业最终在。您不需要使用shell_exec。如果您想在某个时间运行某个东西,您可以直接使用at来调用php脚本,如果您想手动触发它,或者如果您想每天或每周按计划触发它,您可以使用cron。我很困惑,为什么要首先将其包装在php脚本中。这是因为touch是一个内置的shell。@不,不是。