|Just another Perl shrine|
Problem with AIX 5.3 Perl/SH Script and Crontabby stahl (Initiate)
|on May 07, 2012 at 13:32 UTC||Need Help??|
stahl has asked for the
wisdom of the Perl Monks concerning the following question:
Oh Great Perl Monks, I come to you in the most dire of circumstances. I am but a lowely per lnewbie, and google has been a great friend to me. However, it has not been able to answer my greatest question. I created a 3 line perl script to call a shell script(I will list both Below) The current script is using system(), i have however tried both backticks and exec to accomplish my endgoal. None of these have worked. Also i have tried getting the stdout and in statements to work unsuccessfully. Im sure it is something to do with the otuput getting lost and not knowing where to go, but i wont know The real goal of this script is to automate the sophos updating process threw out my unix enviroment, by using this script to output to a file then i will make a nagios script to read the file and check for failed/successful updates. KSH/SH from what i have read and been told will not do inherently what i want it to do, which is why i come to you oh wise an great monks of perl. The OS running this is : AIX 5.3 Tech level 10
Below i shall insert very small code examples: The first script is call savupdate.sh it is apart of the sophos for unix Antivirus client.
This is the scripts output:root# ./savupdate.sh Downloading http://xxx.xxx.xxx.xxx:8000/CIDs/S000/EESAVUNIX/AIX_PPC/server.inf Downloading http://xxx.xxx.xxx.xxx:8000/CIDs/S000/EESAVUNIX/AIX_PPC/cidsync.upd 16763 bytes downloaded in 0.028047 secs (583.670512 KiB/s) Downloading http://xxx.xxx.xxx.xxx:8000/CIDs/S000/EESAVUNIX/AIX_PPC/config/index.spec Downloading http://xxx.xxx.xxx.xxx:8000/CIDs/S000/EESAVUNIX/AIX_PPC/talpa-custom/index.spec Downloading http://xxx.xxx.xxx.xxx:8000/CIDs/S000/EESAVUNIX/AIX_PPC/cac.pem 1131 bytes downloaded in 0.020245 secs (54.556092 KiB/s) Downloading http://xxx.xxx.xxx.xxx:8000/CIDs/S000/EESAVUNIX/AIX_PPC/mrinit.custom Downloading http://xxx.xxx.xxx.xxx:8000/CIDs/S000/EESAVUNIX/AIX_PPC/MRInit.custom Downloading http://xxx.xxx.xxx.xxx:8000/CIDs/S000/EESAVUNIX/AIX_PPC/mrinit.conf 461 bytes downloaded in 0.014299 secs (31.484052 KiB/s) Successfully updated Sophos Anti-Virus from http://xxx.xxx.xxx.xxx:8000/CIDs/S000/EESAVUNIX
The Next script is the smiple 1 lines i wrote, please dont laugh oh great monks for i am in training.
After running this script from command line it works every time. However when trying to run it from crontab it fails everytime..it has also been the case with every other KSH/SH/Perl script i have tried to write...they all work great from command line no problems, however when used with crontab they all fail. I have check to make sure the scripts themself are running by having an active ps -ef going just to make sure they are being executed. It seems that the output and how it is directed is what is illuding me.
Monks, if you could help solve this issue for me i would be eternally grateful! Thank you, your monk in training, Stahl~