Unscheduled crontab execution


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unscheduled crontab execution
# 1  
Old 05-03-2009
Unscheduled crontab execution

Hi All,

Do apologise, for it has been a long while since I was last on the forum. I've been doing documentation and primiarily Windows efforts for some while now. Smilie

We are running a HP-UX 11.23 unit. This morning two separate crontab users executed shutdown scripts of their respective Oracle instance. The script worked (and so it should - I wrote it), however it was the crontab entries that has got me absolutely stumped as to why it ran. Sadly the boss is asking the very same question also.

The entries were as follows:
User#1: 45 2 25 05 0 nice ksh -c "/usr/local/bin/restart_md_v3.1.cron user1 MDAMER ORA stop" >> /usr1/log/user1/cronlog/restart_MDAMER.log 2>&1
..... which is 2:45am 25th May when a Sunday

User#2: 50 2 25 05 0 nice ksh -c "/usr/local/bin/restart_md_v3.1.cron user2 MDEMEA ORA stop" >> /usr1/log/user2/cronlog/restart_MDEMEA.log 2>&1
..... which is 2:50am 25th May when a Sunday

As you can see, neither of the two entries are for today, yet they ran !!

Would anyone have an idea on why these scripts executed or have seen something similar in their travels ???

Cheers,
Cameron
# 2  
Old 05-03-2009
Those crons fire on 25 May and every Sunday.
There is similar example in "man crontab".
Try replacing the day-of-week parameter with an "*" if you want the cron to execute annually on 25 May.
By the way 25 May 2009 is a Monday (it was a Sunday in 2008).
# 3  
Old 05-04-2009
Thanks for the reply methyl.
Yes I do know how to setup crontab entries, but cheers for the reminder.

The question was on the last line.
"Would anyone have an idea on why these scripts executed or have seen something similar in their travels ???"

Cheers,
Cameron
# 4  
Old 05-04-2009
It appears to me that the crontab entry is fine. Howver when it executes it in a wrong time then schedule, it makes me think that
1. the clock isn't right
2. the correct crontab entry is not used. Perhapes there are other crontab entries that was executed. Or do you really if it was initiatated by cron daemon ( or somebody ran the job explicitly).
3. You said two seperate crontab users ran it. Can you check at /var/spool/cron/crontabs and see if there are files created for those two users.


cheers,
Devaraj Takhellambam
# 5  
Old 05-04-2009
Hi Devaraj,
Thanks for the reply & interest.

Clock is ok - first thing I checked.
There are other similar crontab entries, however they run earlier in the evening.
These particular entries I setup last year for a purpose shutdown - I'd just left them there.
Both users have their respective file created in /var/spool/cron/crontabs .

This has me absolutely stumped as to how it even got executed.

Cheers,
Cameron
# 6  
Old 05-04-2009
I agree with methyls answer:
I understand run on may 25 and every sundays (in May...). Depending when you modified your cronfile last year (lets say the 22nd May) you would not have noticed any strange behaviour because the following sunday was ... the 25th... and the last sunday of May...
# 7  
Old 05-04-2009
I can't think of any other reason why it would have executed by itself at the wrong time. Even when the system clock is reset, cron is aborted and restarted. This issue seems to be a timing issue to me..

At this point, you may want to test it with echo commands to check if it is working correctly. test it with those two users.


cheers,
Devaraj Takhellambam
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. HP-UX

Crontab Execution

Hi Guys, I need help to clear my doubt w.r.t Crontab execution. uname -a HP-UX myservername B.11.31 U ia64 1422528451 unlimited-user licenseI created a crontab entry to execute particular job on Saturday 11/15/2014 11:22 Below is the cron entry #refresh DEVDB from PRODDB 22 11 15 11 6... (6 Replies)
Discussion started by: rocky.community
6 Replies

2. UNIX for Dummies Questions & Answers

Execution Problems with Crontab

Dear Folks, I have written a shell script which internally connects to oracle database through sqplplus command line. The script runs fine when run manually. Now I am scheduling it to run (Linux environment) from crontab. In crontab it is failing with an error: sqlplus command... (6 Replies)
Discussion started by: tamojitc
6 Replies

3. Shell Programming and Scripting

Problem with Job execution using crontab

Hi All, I am facing a problem with crontab.I made an entry in crontab like this 05 07 * * * /afs2/cdwfullacc/current/exe/cdw_generate_special_klant.sh > /afs2/cdwfullacc/current/scratch/cdw_gen_cron.log But job was not getting executed. Entry in crontab was made with same user by whom... (4 Replies)
Discussion started by: krishna_gnv
4 Replies

4. Shell Programming and Scripting

Execution of Unix script after every second without crontab

Hi, I have shell script "A" which is executing oracle pl/sql procedure and initiate its multiple threads at a time as below on given user value in an other script "B". I want to execute script "A" after every second with out cron tab as " A " will keep on executing after every second till... (1 Reply)
Discussion started by: saad.imran@gmai
1 Replies

5. Shell Programming and Scripting

Expect Issue Serial Forground Execution vs Concurrent Background Execution

I have an expect script that interrogates several hundred unix servers for both access and directories therein using "ssh user@host ls -l /path". The combination of host/path are unique but the host may be interrogated multiple times if there are multiple paths to test. The expect script is run... (2 Replies)
Discussion started by: twk
2 Replies

6. UNIX for Dummies Questions & Answers

Problem with Crontab execution

Hi I have shell script to excute the SQL script.And i have scheduled those shell script in crontab.But the Shell script is not running timely and i got the below error Crontab entry 15 05 17 7 * /export/home/vcpsapp/vcps/stat.sh Output Your "cron" job on uspxivus16... (3 Replies)
Discussion started by: mak_boop
3 Replies

7. UNIX for Dummies Questions & Answers

Execution problems with crontab

I need your help please Inin a production system i found crontab entries was removed because i typed crontab -l with username corasc and didn't show anything. i asked the administrador to restored the mentioned crontab, he restored the crontab: The problem is when restored the crontab file is... (2 Replies)
Discussion started by: alexcol
2 Replies

8. Shell Programming and Scripting

crontab execution

is it possible to soecify time overnight in 5 days for example: 0 18-7 * * 1-5 /mycode is this okay to use 18-7 because im not getting the results correctly? (4 Replies)
Discussion started by: vadharah
4 Replies

9. Shell Programming and Scripting

execution without ./

I want to execute a shell script without ./ symbol. For example: ./my_script ===== my_script (both of them can execute my script) both of them are the same as result. (7 Replies)
Discussion started by: mehmetned
7 Replies
Login or Register to Ask a Question