I have a job which created by PHP script running as www (nginx)
31 2014-06-09 19:08 a www
After the time passed, the job is executed but nothing happens.
But if i run it as a root,
32 2014-06-09 19:09 a root
the job is executed and i can get the result.
Any idea how to allow www run the at job?
EDIT: This is how my php script executing at command
$command = 'echo "/usr/bin/php -q /home/wwwroot/cron/poster.php 8137660219700061402317686 1" | at now + 1 minute';
shell_exec($command);
There will be a job listed, created by www
atq -c 48
More info regarding the at job,
48 2014-06-09 21:08 a www
[root@914K7 ~]# at -c 48
#!/bin/sh
# atrun uid=501 gid=501
# mail www 0
umask 22
USER=www; export USER
PWD=/home/wwwroot/ajax; export PWD
SHLVL=1; export SHLVL
HOME=/home/www; export HOME
cd /home/wwwroot/ajax || {
echo 'Execution directory inaccessible' >&2
exit 1
}
${SHELL:-/bin/sh} << 'marcinDELIMITER509e6acf'
/usr/bin/php -q /home/wwwroot/cron/poster.php 81376602197000614023176 1
marcinDELIMITER509e6acf
But after time passed, the job is gone meaning it has been executed, but I dont receive any output from the script.
If I manually create at job through command line as a root, I'm getting output after the job is executed.
sudoers
entry into your question, plus the modified line of PHP code that invokes sudo, and the results ofatq
after you've submitted a job. Just telling us what you think you've done is no help, because you may well not have done what you think.ls -lart /var/log
to see which file it has logged to. On Ubuntu the logfile to look at is/var/log/syslog
.