The crontab did not execute?

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat The crontab did not execute?
# 1  
Old 06-02-2011
The crontab did not execute?

Dear!

I've 2 scripts backup Oracle database in crontab environment, however, I found they did not execute. The cron is here

Code:
$ crontab -l
30 2 * * 0 sh /cloudbck/level0/level0.sh
19 3 * * * sh /cloudbck/level1/level1.sh

Then, I tried to find how did they not run by looking up /var/log/cron
Code:
Jun  2 08:45:33 cloudsme crontab[23014]: (oracle) LIST (oracle)
Jun  2 08:47:01 cloudsme crontab[23051]: (oracle) BEGIN EDIT (oracle)
Jun  2 08:47:06 cloudsme crontab[23051]: (oracle) REPLACE (oracle)
Jun  2 08:47:06 cloudsme crontab[23051]: (oracle) END EDIT (oracle)
Jun  2 08:48:01 cloudsme crond[5996]: (oracle) RELOAD (cron/oracle)
Jun  2 08:48:17 cloudsme crontab[23123]: (oracle) BEGIN EDIT (oracle)
Jun  2 08:48:29 cloudsme crontab[23123]: (oracle) REPLACE (oracle)
Jun  2 08:48:29 cloudsme crontab[23123]: (oracle) END EDIT (oracle)
Jun  2 08:49:01 cloudsme crond[5996]: (oracle) RELOAD (cron/oracle)
Jun  2 08:49:01 cloudsme crond[23195]: (oracle) CMD (sh /cloudbck/level1/level1.sh)
Jun  2 08:50:01 cloudsme crond[23254]: (oracle) CMD (sh /cloudbck/level1/level1.sh)

I did not found effect information here, and if I force to run script, it worked normally.

Please help me to verify and correct.

Thank you very much!
# 2  
Old 06-03-2011
Here are some things to consider. If your script is already a shell script, don't invoke a new shell to run your script. Just make sure it contains a proper shebang (#!/<path to your shell interpreter>)

Also, in cron, you do not get a full environment. Your script may run into problems if the environment is too sparse. A common solution is to source an environment setting file inside your script.
# 3  
Old 06-03-2011
Quote:
Originally Posted by mark54g
Here are some things to consider. If your script is already a shell script, don't invoke a new shell to run your script. Just make sure it contains a proper shebang (#!/<path to your shell interpreter>)
Thank you for your reply!
I remove the sh before my shell script, and test again

Quote:
Also, in cron, you do not get a full environment. Your script may run into problems if the environment is too sparse. A common solution is to source an environment setting file inside your script.
Yes, I know, I set the # /bin/ksh for the script. Please view:
The crontab did not execute?-cron_1jpg
The crontab did not execute?-cron_2jpg

and after 1 minute later, I check again:

The crontab did not execute?-cron_3jpg
The crontab did not execute?-cron_4jpg


Thanks for advice!
# 4  
Old 06-03-2011
As per the snapshot/picture1, the shebang is not properly set. It should #!/bin/ksh.
# 5  
Old 06-08-2011
Quote:
Originally Posted by oky
As per the snapshot/picture1, the shebang is not properly set. It should #!/bin/ksh.
Dear!
I added in the script, but it's not running still now.
Code:
$ crontab -l
30 2 * * 0 /cloudbck/level0/level0.sh
19 3 * * * /cloudbck/level1/level1.sh

$ cat /cloudbck/level1/level1.sh
#!/bin/ksh
rman target / @/cloudbck/level1/level1.rc

$ cat /cloudbck/level0/level0.sh
#!/bin/ksh
rman target / @/cloudbck/level0/level0.rc

$ ls -lrt level0.sh
-rwxr-xr-x 1 oracle oinstall 53 Jun  8 09:14 level0.sh
$ ls -lrt level1.sh
-rwxr-xr-x 1 oracle oinstall 54 Jun  9 08:47 level1.sh

I tried to test per minute to run the job in crontab
Code:
0-59 * * * * /cloudbck/level1/level1.sh

& the log is here
Code:
Jun  8 09:16:01 cloudsme crond[4336]: (oracle) CMD (/cloudbck/level1/level1.sh)
Jun  8 09:17:01 cloudsme crond[4383]: (oracle) CMD (/cloudbck/level1/level1.sh)
Jun  8 09:18:01 cloudsme crond[4401]: (oracle) CMD (/cloudbck/level1/level1.sh)
Jun  8 09:19:01 cloudsme crond[4421]: (oracle) CMD (/cloudbck/level1/level1.sh)

If I force to execute the script in command line in $, it ran successfully.


May you help me?
Thank you very much!

Last edited by trantuananh24hg; 06-08-2011 at 11:03 PM..
# 6  
Old 06-09-2011
Whose crontab is that again? Have you tried sourcing their environment in at the beginning of the script?
# 7  
Old 06-17-2011
Quote:
Originally Posted by mark54g
Whose crontab is that again? Have you tried sourcing their environment in at the beginning of the script?
The oracle user is the owner user of cronjob which submmited by crontab.
Yes! I've tried to view source enviroment of script. I did not found any error.

Thank you for your reply!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Crontab scheduler to execute script every 45 days

Can someone please help me on how to schedule script to run every 45 days in crontab ? Thanks, Prince (5 Replies)
Discussion started by: prince1987
5 Replies

2. Red Hat

root crontab wont execute a script

Greetings/ I have a script listed in my roots crontab 07 9 * * * /opt/HLRSDATA_2010_OCT/HLRS_Scheduler_sp.sh > /opt/HLRSDATA_2010_OCT/logs/HLRTKJob.log This script contains the following #!/bin/bash echo HLRSData Scheduler cd /opt/HLRSDATA_2010_OCT /usr/bin/java -Xms32m -Xmx1024m -cp... (6 Replies)
Discussion started by: RedSpyder
6 Replies

3. UNIX for Advanced & Expert Users

Crontab can not execute

Hi, on AIX 6.1, I put in crontab ,execution of myscript. But it sends back the following error : myscript.sh: rman: not found And in myscript I have : rman catalog rman/**@rep target / LOG=file.log << EOF run { allocate channel t1 type disk; ......... } exit EOF... (1 Reply)
Discussion started by: big123456
1 Replies

4. Shell Programming and Scripting

Execute via crontab taking username/password from file

Dear All Here is the details what i want to achieve from shell scripts I have a sever where 5 databases are created. which i having diffrent SID's. Now i want to execute some SQL queries on each one of the databases. (SQL Query is same).That i want to acheive via crontab Now each one of the... (2 Replies)
Discussion started by: jhon
2 Replies

5. UNIX for Dummies Questions & Answers

Crontab works but does not execute script

Hi guys, my first post time here, so hello to everyone :) I've got a problem running one of my scripts at work. I can get crontab working on simple scripts (i.e. one that just outputs date to a temp file). but it won't correctly execute the script i want to use. My script is a PHP script. It... (6 Replies)
Discussion started by: renegadeice
6 Replies

6. Shell Programming and Scripting

Crontab error Cannot execute binary file.

Anyone can help me ? I try to using crontab with a simple shell script as echo it run okay but now i have more command in script. when I set entry to crontab and whe it run i get mail with error cannot execute binary file. it urgent so please help me the soutions. Thank so much for your help.... (5 Replies)
Discussion started by: raccsdl
5 Replies

7. UNIX for Dummies Questions & Answers

how to execute sh script in bash shell via crontab

hello. we are porting over from HPUX Shell to Linux. my default shell is bash so i can no longer schedule to execute a sh script in crontab. can anyone pls help me out? I searched the site but didnt find any details. thanks! (1 Reply)
Discussion started by: jigarlakhani
1 Replies

8. UNIX for Dummies Questions & Answers

Can crontab execute binary files?

Hello! I have an entry on my crontab. 10 00 * * * /bscsprod/bscs/prod/523/bin/tehcron.sh $ /bscsprod/bscs/prod/523/bin/vi tehcron.sh nohup teh -t -f > /dev/null & ~ ~ ~ ~ ~ ~ ~ ~ "tehcron.sh" 13 lines, 365 characters but executing the script from the... (5 Replies)
Discussion started by: Tris
5 Replies

9. Shell Programming and Scripting

Need to execute a complete url from crontab

Hi, I need to execute a URL through crontab. Please could you help me to. I need something like 15 0 * * * http://www.mysite.com/index.php. Is it possible. If not, how can I execute a script from another server.. Any help will be appritiatable. Many thanks, Nissar.P.K (2 Replies)
Discussion started by: nissar
2 Replies

10. Programming

crontab ..sqlplus cannot execute

i have shell script. when i run in normail mode..it run ok but when i use crontab command to set that program run in certain time it give an error. error 'SQLPLUS cannot execute' what the problem.i already set all the correct path and use both root and normal id but still cannot execute properly. (1 Reply)
Discussion started by: zikronz
1 Replies
Login or Register to Ask a Question