At command for Linux job not working from php


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting At command for Linux job not working from php
# 8  
Old 06-09-2016
Quote:
Originally Posted by extra93
yes from a browser, php and apache are installed on my VPS debian 7

at comand not allowd ?? how can i slove that sir Smilie
Run the command stomp gave you and tell us what it says.
# 9  
Old 06-09-2016
Quote:
Originally Posted by stomp
Hi extra,

if you execute the command I wrote before, you'll get an error message, which will help you to figure out your problem.
oh sorry STOMP yes i tried but no file exist in /tmp/ or am i wrong on somethings ?

'at' cammand always ignored from php even when i put 'at' comand in script and run it from php at camand ignored and the reste of code works,

one more time sorry for my english
# 10  
Old 06-09-2016
Quote:
oh sorry stomp yes i tried but no file exists in /tmp/ or am I wrong on somethings ?
Obviously something is wrong....

You can check file permissions. Maybe your script has no access to /tmp. Please post the output of the following commands:

Code:
ls -ld /
ls -la /tmp

Maybe you typed in my command not 100% exact as I typed it here? I suggest you to double check it and copy&paste it here in. Maybe there's error.
Please always use code tags for code, input files, or command output. That's this icon: Image

...and as a very likely issue that will be present here: please use absolute path names! Instead of this...

Code:
shell_exec('at -f phpsc.sh now + 5 minute >/tmp/log.txt 2>&1');

...use this...
Code:
 shell_exec('/usr/bin/at -f /path/to/your/script/phpsc.sh now + 5 minute >/tmp/log.txt 2>&1');

Have a look at your php.ini too. Especially at the setting disable_functions. Maybe shell_exec is listed there?

Last edited by stomp; 06-09-2016 at 07:01 PM..
This User Gave Thanks to stomp For This Post:
# 11  
Old 06-09-2016
Quote:
Originally Posted by stomp
Obviously something is wrong....

You can check file permissions. Maybe your script has no access to /tmp. Please post the output of the following commands:

Code:
ls -ld /
ls -la /tmp

Maybe you typed in my command not 100% exact as I typed it here? I suggest you to double check it and copy&paste it here in. Maybe there's error.
Please always use code tags for code, input files, or command output. That's this icon: Image

...and as a very likely issue that will be present here: please use absolute path names! Instead of this...

Code:
shell_exec('at -f phpsc.sh now + 5 minute >/tmp/log.txt 2>&1');

...use this...
Code:
 shell_exec('/usr/bin/at -f /path/to/your/script/phpsc.sh now + 5 minute >/tmp/log.txt 2>&1');

Have a look at your php.ini too. Especially at the setting disable_functions. Maybe shell_exec is listed there?


Ooh Thank you bro this realy helps me, here is what i get in LOG.TEXT:

from terminal:
Code:
warning: commands will be executed using /bin/sh
job 56 at Thu Jun  9 23:34:00 2016

from php (shell_exec):
Code:
You do not have permission to use at.

Smilie SmilieSmilie

---------- Post updated at 05:44 PM ---------- Previous update was at 05:33 PM ----------

in /etc/at.deny i have this user list or i don't know what, the permission probleme come frome here i think ???

alias
backup
bin
daemon
ftp
games
gnats
guest
irc
lp
mail
man
nobody
operator
proxy
qmaild
qmaill
qmailp
qmailq
qmailr
qmails
sync
sys
www-data
# 12  
Old 06-09-2016
There's a manual page for that file...

Code:
man at.deny

This User Gave Thanks to stomp For This Post:
# 13  
Old 06-09-2016
SOLVED :) :)

i have find the solution thank you guys,

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

i hope this topic help another one Smilie
This User Gave Thanks to extra93 For This Post:
# 14  
Old 06-10-2016
Quote:
Originally Posted by extra93
yes from a browser, php and apache are installed on my VPS debian 7

at comand not allowd ?? how can i slove that sir Smilie

---------- Post updated at 03:03 PM ---------- Previous update was at 02:58 PM ----------



i have cheked php.ini and not found 'at' on the not allowed comand list Smilie
You looked at the wrong place. See http://linux.die.net/man/5/at.allow .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Simple sed command not working; could be a Mac/Linux vs. PC/Linux issue

Hello, I am on a Mac and trying to clean up some monthly files with a very simple SED: sed '3,10d;/<ACROSS>/,$d' input.txt > output.txt (from the input, delete lines 3 - 10; then delete from the line containing <ACROSS> to the end of the file) then output to output.txt Even when I try... (2 Replies)
Discussion started by: verbatim
2 Replies

2. Homework & Coursework Questions

NDM command to run a Mainframe job from Linux

Hi Experts, I am trying to run a Mainframe Job from Linux using NDM process. I will be passing the contents of the Mainframe job as an parameter to the NDM script. This is working fine with FTP when i use the option filetype = jes, but in NDM i am not able to identify a similar option like... (2 Replies)
Discussion started by: arun1377
2 Replies

3. UNIX for Dummies Questions & Answers

SWAP command not working on Linux machine

Hi I am working on linux machine and swap command is not working Linux Machine On Solaris machine it is working fine: uname -a SunOS rgsm01 5.9 Generic_118558-03 sun4u sparc SUNW,Sun-Fire-V440 swap -s total: 6596320k bytes allocated + 1035968k reserved = 7632288k used, 38893408k available ... (5 Replies)
Discussion started by: Basant Mishra
5 Replies

4. Red Hat

isql command not working in Linux 64bit

I am using Linux RHEL5 64 bit and installed oracle 11g. I want to check ODBC connection , i had modified odbc.ini file when i use this command -isql I am getting following error . bash: isql: command not found Kindly help (5 Replies)
Discussion started by: roopalidalvi231
5 Replies

5. Shell Programming and Scripting

AWK command working different in Linux

Hi All I have fired a command in linux table=`echo ${file_name} | awk '{FS="/"; print $NF}' | awk '{FS="."; print $1}'` where file_name has /data/ds/dpr_ebicm_uat/backfill/temp/etl_app_info.csv /data/ds/dpr_ebicm_uat/backfill/temp/etl_app_jobs.csv ... (10 Replies)
Discussion started by: vee_789
10 Replies

6. Shell Programming and Scripting

sed command working different in linux environment.

Hi I tried running the code scrname=`whence $0 | sed -e 's/\.\///g'` where $0 is substituted by cm_dsjobrun.sh in unix env then the value it returns me is SCRNAME=/data/ds/dpr_ebicm_uat/etl/cm3_0/scripts/shell/cm_dsjobrun.sh whereas i ran the same code on linux env The value... (9 Replies)
Discussion started by: vee_789
9 Replies

7. Shell Programming and Scripting

no command is not working to send a mail in linux redhot server

HI All, I am facing the problem with rmail ... Actually my server is linux environment Redhot server. To send a mail which command I have to use it . I want subject and I want to Include CC also And body of the mail also there . But If I use rmail command it is not taking any options to... (1 Reply)
Discussion started by: ksrivani
1 Replies

8. Shell Programming and Scripting

ITcl :: try_eval command not working in Linux 5.4

Hi, My code uses try_eval block to do some code execution. This piece of code does not work on RHEL 5.4. The program just hangs at the try_eval block and does not throw any errors either. The same program however works in other Linux boxes that we have. I have written a simple program that... (0 Replies)
Discussion started by: archana485
0 Replies

9. Shell Programming and Scripting

Sudo command not working with cron job.

Hello, I have written a script that has a sudo command to change file permissions within it. When I run the script manually, the sudo command inside of it works fine. When the script is run through crontab I get the error "cron: not found". It the same user profile that I am using... (6 Replies)
Discussion started by: WhotheWhat
6 Replies

10. Programming

cos() command not working in Linux

Hi, I have written a c program to find cos() of a value , its not working, I am getting value of "val " as 0000. #include<stdio.h> #include<math.h> main() { float val; val = cosf( 1.570796); printf("\nval = %f",val); } (9 Replies)
Discussion started by: shashi
9 Replies
Login or Register to Ask a Question