Hello Guys,
I have scratched my head alot on this but couldn't find clue what's wrong. Can you please help me with this? My problem is as following.
1) When I manually execute following script it runs successfully with below output.
bash-3.00# more smssend
#!/bin/bash
echo -e "<Request MO="SMPPSMS-local" Operation="Set" Origin="PPAS">
<MSISDN>923455858076</>
<Version>1</>
<Message>ivr ocmp-bre is down, restarting bre
</>
</Request>"|/opt/EABfds/bin/FDSRequestSender -u sdpuser -p sdpuser
bash-3.00# ./smssend
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<Response>
<Result>Ok</Result>
But when I run the same script through crontab it does not run.
bash-3.00# crontab -l|grep smssend
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /export/home/fdsuser/IVR/smssend
Can somebody please identify what is wrong?
Regards,
Umar
all of your script(smssend) is this?
what is the "</Response>", is the output after executed the your script by crond ?
Hello ygemici,
Yes, smssend is all of my script.
In my earlier post "</Respone>" was a typo in crontab entry. Correct one is as below.
bash-3.00# crontab -l|grep smssend
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /export/home/fdsuser/IVR/smssend
When I execute smssend manually, below is the successful response.
[/COLOR]
bash-3.00# ./smssend
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<Response>
<Result>Ok</Result>
I am guessing crontab is unable to run my script because its unable to parse above output. But I am not sure though.
Regards,
Umar
maybe your script runs fine ?
did you check the crond logs?
..........
crond[XXXX]: (root) CMD (XXXXXXXXXX)
and can you try like this ?
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /export/home/fdsuser/IVR/smssend >> /tmp/smssend_results
Leion
May 28, 2012, 3:35am
5
I think this is to do with your profile..
try to source your .profile or any other custom profile in your smssend script
Couldnt find crond logs on my machine and doing below also didn't help.
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /export/home/fdsuser/IVR/smssend >> /tmp/smssend_results
check the permission on file you are trying to execute from cron. sometimes it gives lots of pain.
umarsatti:
Couldnt find crond logs on my machine and doing below also didnt help.
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /export/home/fdsuser/IVR/smssend >> /tmp/smssend_results
isn't there a file (/tmp/smssend_results) ?
Yes, this file "/tmp/smssend_results" is created but its empty.
And script rights are also fine.
Hi, did you check the FAQ first?
FAQ: cron and crontab
it says:
Sorry, the page you have requested cannot be found.
You can search this site if you are looking for something specific about Linux or UNIX.
try in this way -
check for both the output and error from script.
0,5,10,15,20,25,30,35,40,45,50,55 * * * * "/export/home/fdsuser/IVR/smssend" >> /tmp/smssend_results.out 2>> /tmp/smssend_results.err
umarsatti:
it says:
Sorry, the page you have requested cannot be found.
You can search this site if you are looking for something specific about Linux or UNIX.
The first minute the post had a wrong link, before it was corrected. Please try again.
what say "/var/adm/cron/log" ?
methyl
May 28, 2012, 9:02am
15
Also look in unix mail for the user who owns the crontab. This is where any fundamental error messages (like permissions on the script file) will be found.
Hello Umar
I really admire your enthusiasm for shell scripting and thanks for your contribution towards this forum. you can solve this by putting following in crontab:
bash -l script
1 Like
Thank you kashif, executing script with "bash -l" in crontab solved my problem. =)
However can somebody please explain logic behind this?