issue with running script with crontab


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting issue with running script with crontab
# 1  
Old 08-27-2009
issue with running script with crontab

I am facing a strange issue while running a script(eg A) from the crontab entry
the script calls one more script(eg B) within it
now when i run the script A manually(with nohup) it also executes the script B (embedded inside it) as expected.

but when i run the script A from the crontab entry it runs the script A,
it also executes all the statements above and below the call to script B
but does not executes script B

Please Advice and let me know if more details are needed
# 2  
Old 08-27-2009
is this a root crontab?

what file permisions do you have on file A and file B.
# 3  
Old 08-27-2009
yes the crontab is root and i am having 777 file permissions for both
# 4  
Old 08-27-2009
777 is bad for security but good for de-bugging :-)

are you calling file B with full path?
or assumeing a PATH has been set?
# 5  
Old 08-27-2009
The script B lies in /xyz/abc directory

i am changing the directory to /xyz/abc in script A
and then calling the script B
# 6  
Old 08-27-2009
please post both scripts so we don't need to guess.
# 7  
Old 08-27-2009
I would bet for a path problem as suggested above. The best way to troubleshoot a cron problem is to redirect the STDERR to a file or active TTY:

Code:
* * * * * /full/path/to/script 2> /tmp/cron_err

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Script problem when running on crontab

Hi guys! I created a backup script that works fine when I run manually, but when I put a crontab job to execute it the result are not the expected. (not a time problem). Here is my script: bash-3.00# cat /bk_tool/backup2.sh #!/usr/bin/csh clear set DIR_HOST='SCP08' ... (3 Replies)
Discussion started by: andredemartini
3 Replies

2. Shell Programming and Scripting

Issue in running shell script in crontab

I'm having a shell script which has to be run only once at the specified time. Shell script is like following, #!/bin/bash db2 connect to XXX > connection_status.txt This script is scheduled in crontab as following, 50 4 8 5 0 sh script.sh scheduled script is run at the specified time... (1 Reply)
Discussion started by: Rajkumar Gandhi
1 Replies

3. UNIX for Dummies Questions & Answers

crontab not running script

Hi All, I am having the below script to be run from crontab, it it doesnt run. 1 * * * * /home/cobr_ext/test.sh > /home/cobr_ext/temp.txt when i run i manally it runs without any issues. Could please help me as to why doesnt it run the script.:( (7 Replies)
Discussion started by: abhi_123
7 Replies

4. UNIX for Advanced & Expert Users

Particular script not running through crontab

Hi, I have created the below script, set -x # Set the Path of Environment file ENV_FILE_DIR=/opt/app/p1trp1c1/sybase/ecdwqdm/xrbid/QDM_Prod/bin LOG_DIR=/opt/app/p1trp1c1/sybase/ecdwqdm/xrbid/QDM_Prod/log export ENV_FILE_DIR export LOG_DIR # Set Audit Environment . ${ENV_FILE_DIR}/QDM.env... (8 Replies)
Discussion started by: yohasini
8 Replies

5. UNIX for Dummies Questions & Answers

Issue while running from crontab

Hi All, Here is my command which I've scheduled to be run from crontab, but it's giving error message: rah: rahhost executable needed but not in PATH My cmd is- 36 10 * * * /opt/IBM/dwe/db2/V9.5/bin/rah "df -m" >> /db2home/bculinux/Files/log/db.out 2>&1 Though I've added path... (5 Replies)
Discussion started by: NARESH1302
5 Replies

6. Shell Programming and Scripting

rah issue when running from crontab

Hi All, I've prepared a script, content is- #!/bin/bash echo "HI" > /tmp1 rah ";\ df -m" | sort -u >> /tmp1 echo "BYE" >> /tmp1 I've scheduled this script to be run thorugh crontab, but the script is not being able to run rah command. The output file is coming like this- $cat... (4 Replies)
Discussion started by: NARESH1302
4 Replies

7. Shell Programming and Scripting

Crontab not running a script

Hi, I posted this in the Solaris forum but I think this one would be more appropriate. I created a script starting with the following lines: #!/usr/bin/ksh flag=n export flag typeset -i quant=0 (...) When running it I'm getting the following 2 errors: /tmp/tstscript/testfail.ksh:... (9 Replies)
Discussion started by: Cvg
9 Replies

8. Red Hat

Problems with script running with crontab

Hi, I'm trying the backup a few information commands of my Check Point FW (it's on a SPLAT linux machine). This is the script I wrote: #!/bin/bash cd /var/tmp/ file1=netstat_`/bin/date +%d%m%y`.txt file2=ifconfig_`/bin/date +%d%m%y`.txt file3=cpstatos_`/bin/date +%d%m%y`.txt... (2 Replies)
Discussion started by: nirsh
2 Replies

9. UNIX for Dummies Questions & Answers

Getting error when running script through crontab

Hi all, I wrote small script for Solaris and when I am running it through command prompt its ok, but when I trying to run it using crontab, i am getting error like: ld.so.1: dbloader: fatal: libACE.so: open failed: No such file or directory /tmp/file.sh: line 5: 8304 Killed ... (4 Replies)
Discussion started by: nypreH
4 Replies

10. Shell Programming and Scripting

Facing issue in Solaris OS in crontab for running shell script

Hello i have a shell script. it is running fine when i manually run at command prompt using following command ./script_file but while running shell script from crontab, it is giving error in each line. (2 Replies)
Discussion started by: mabrar
2 Replies
Login or Register to Ask a Question