Issue in running shell script in crontab


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Issue in running shell script in crontab
# 1  
Old 05-08-2013
Java 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 and the connection_status.txt also created. But the file doesn't contain any content and file size is 0 byte.

Note: When I'm running the script as usual (without scheduling), Script runs fine and creates the connection_status.txt file with appropriate content.

Please help to know the reason why the scheduled script doesn't produce the expected result.

Thanks,
Rajkumar
# 2  
Old 05-08-2013
Please check our FAQ before posting!

https://www.unix.com/answers-frequent...n-crontab.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue with running commands from shell script

I'm trying to copy files from a remote windows server to Unix server. I was successfully able to copy files from windows server using command prompt but when I run these commands from a script it's not working as expected. commands used: sftp user@remoteserver.com lcd local_dir cd... (3 Replies)
Discussion started by: naresh7590
3 Replies

2. Shell Programming and Scripting

Shell scripting issue-running the background script

I have written the below query to genrate a telephone.I am passing account number from oracle database. I am calling 2 scripts which generate the bill 1. bip.sh (it runs in the background) 2.runXitInvoice_PROFORMA_integ bip.sh generates a number which runXitInvoice_PROFORMA_integ uses.How... (7 Replies)
Discussion started by: rafa_fed2
7 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. Shell Programming and Scripting

Part of the Shell script is not running via crontab, runs fine manually

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)
Discussion started by: gowthamakanthan
18 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

output file of the shell script running through crontab is deleting automatical daily.

Dear Friends, I am working on IBM AIX. I have written one script and kept in the crontab as to run daily at 11:38 AM. and the output of the script to be appended to the file generated with the month name. but my file deleting daily and the new file is creating with the output of the shell... (2 Replies)
Discussion started by: innamuri.ravi
2 Replies

8. Shell Programming and Scripting

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... (7 Replies)
Discussion started by: mad_man12
7 Replies

9. Shell Programming and Scripting

problem running shell script (for oracle export) in crontab

Hello Gurus, I've been tasked with solving a problem at my new job and I'm stumped. We've got a script that dynamically builds an oracle export parameter files and then runs export from the shell. it runs fine when using the shell, but will NOT run (fails in one spot everytime) when entered... (1 Reply)
Discussion started by: jsheehan223
1 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