Shell script not getting called through cron job but executes fine manually.
Hi,
My shell script not getting called through cron job.
The same works fine when executed manually.
I tried to generate logs to find if the scripts has some errors related to path using following command- trying to execute .sh file every 5 mins:
But even the logs are not getting generated at the mentioned path.
The shell script is located in the folder root/home/myfolder.
Can any one help me idenfy the issue and its resolution.
Any help/suggestion would be greatly appreciated.
Last edited by methyl; 07-03-2012 at 07:41 PM..
Reason: please use code tags
Please post what Operating System and version you are running and what Shell you normally use (regardless of the default Shell for you cron).
If there is something fundamental wrong, the error message will be found in unix mail for the owner of the crontab.
A common issue would be if /home/myfolder/abc.sh was not executable by the owner of the cron.
Ps. The script as posted in post #3 contains many syntax/design? errors and there is no way that it works with or without cron. Please outline what the script is intended to do because deducing this from faulty code is impossible.
Pps. Please post in proper English not textspeak.
Ppps. The script in the crontab line as posted the script takes a parameter. Nowhere in the the posted script is the parameter referenced. Hmm, perhaps the crontab line is wrong.
Perhaps the crontab line should be something like this:
That should explain your missing logfile.
I think that an important question is where precisely in the directory tree for your server is the directory my_ARCHIVE? Please be aware that the \ character in unix protects a character from interpretation by the Shell whereas a / character could be part of a path describing a directory tree. Microsoft Operating systems use \ characters in path names,but unix Operating Systems use / in path names.
Hello Lads,
I deployed a script on my mac to start and stop EC2 instances on AWS console. The script when started manually on the terminal does the expected stop and start. Problem is when i try to schedule it on a cron, it fails to recognize the AWS Keys which i set up as ENV variable by... (2 Replies)
Hi, I've got a Bash backup script I'm trying to run on a directory via a cron job nightly. If I ssh in and run the script manually it works flawlessly. If I set up the cron to run evertything is totally messed up I don't even know where to begin.
Basically the path structure is
... (6 Replies)
I get a different output when i manually run the .sh script and when it is run by a cron job. Please help me ..
TMP1="/lhome/bbuser/script/wslog/sar.t1"
TMP2="/lhome/bbuser/script/wslog/sar.t2"
TMP3="/lhome/bbuser/script/wslog/sar.t3"
OUTPUT="/lhome/bbuser/script/wslog/sar.out"... (8 Replies)
Hello Team,
As a part of my job we have made a script to automate a service to restart frequently.
Script having two functions when executing it's should find the existing service and kill it, then start the same service . Verified the script it's working fine when executing... (18 Replies)
Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered.
The script is as follow:
#!/bin/sh
for file in file_1.txt file_2.txt file_3.txt
do
awk '{ print "0" }' $file > tmp.tmp
mv tmp.tmp $file
done
And the cron... (2 Replies)
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... (16 Replies)
Hello,
I am working one one script where I am using the below code which is using to connect with MKS client when I run my script manually it works effiecently i.e. it connects with MKS client but when I run it from CRON it doesn't connect.
1)Can some one tell when it is running from cron... (1 Reply)
Hi
Script not getting executed via cron but executes successfully when executed manually. Please assist
cbspsap01(appuser) /app/scripts > cat restart.sh
#!/bin/ksh
cd /app/bin
date >>logfile.out
echo "Restart has been started....." >>logfile.out
date >>logfile.out
initfnsw -y restart... (3 Replies)
I have a very basic script that essentially sends a log file, via FTP, to a backup server. My cron entry to run this every night is:
55 23 * * * /usr/bin/archive_logs
The script runs perfectly when executed manually, and actually worked via cron for about three weeks. However, it mysteriously... (3 Replies)