yassine
yassine

Reputation: 31

at command for linux job not working from php

I have a script .sh with a command in it:

curl --digest "http://xxxxxxx.xxx/[email protected]";

from terminal this works good :

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

from php this works good:

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

from terminal this works good:

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

from php this won't work:

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

even when I put at command in script and run the script from php the at command it will be ignored :(

Upvotes: 1

Views: 132

Answers (3)

PJunior
PJunior

Reputation: 2767

In CentOS 7, I had to add 'apache' at /etc/at.allow.

Upvotes: 0

yassine
yassine

Reputation: 31

i have find the solution,

i removed www-data from /etc/at.deny and now 'at' comand works fine from php (sell_exec)

Upvotes: 2

J. Chomel
J. Chomel

Reputation: 8395

I know its sometimes necessary to use source to invoke environment variables.

Here it what you should try (adapt if you use something else than ):

shell_exec('source ${HOME}/.kshrc ; at -f phpsc.sh now + 5 minute'); 

Upvotes: 0

Related Questions