Unscheduled crontab execution


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unscheduled crontab execution
# 8  
Old 05-04-2009
Since a day ago your first post:
it launched on the first sunday of May... so for methyl and I we seem to stick to our interpretation and see no error and why am I so sure?
Well when I wanted to execute a job of the first sunday of the month,my cron would see, lets say (true examples...)
Code:
00 04 * * 0   /sm/bin/archive_mensuelle >>/sm/log/archive_mens.err 2>&1

in archive_mensuelle file, guess what you find:
Code:
# test sur le week number of the year
if [ $(date '+%d') -lt 8 ]
then
  /usr/adsm/dsmc archive -archmc="1year" -desc="exportmensPOP$(date)" '/export/*.dmp'
fi

# 9  
Old 05-05-2009
Hi Cameron, no offence. vbe and I are in agreement.
Your original cron will next fire on Sunday 10 May 2009.

I quote from a HP-UX "man crontab".

Quote:
Note that the specification of days can be made in two fields: monthday and weekday.
If both are specified in an entry, they are cumulative. For example,

0 0 1,15 * 1 command

runs command at midnight on the first and fifteenth of each month, as
well as every Monday. To specify days in only one field, set the
other field to asterisk (*). For example,

0 0 * * 1 command

runs command only on Mondays.

Hope this helps.
# 10  
Old 05-05-2009
No offence taken Methyl.

But if the below is to become cumulative:
45 2 25 05 0 .........

Why is it that I'd not had the script run prior to now ?? The script had been sitting undisturbed since May 2008.
# 11  
Old 05-05-2009
Because Im quite sure you scheduled it sometime the last week of may 08 and in may 08 the last week left you with one sunday and that sunday was the 25th.
Here are some more examples from :
Newbie: Intro to cron
in notes:
Quote:
Under dow 0 and 7 are both Sunday.

If both the dom and dow are specified, the command will be executed when
either of the events happen.
e.g.
* 12 16 * Mon root cmd
Will run cmd at midday every Monday and every 16th, and will produce the
same result as both of these entries put together would:
* 12 16 * * root cmd
* 12 * * Mon root cmd
And here is a thread on ITRC forum HP of almost the same issue:
Quote:
If I would like to set a crontab schedule job that run one time only per month , the day must the first Sunday of every month , I try " 0 1 1 * 0" , but it will run every Sundy and 1st , can advise what can I set ? thx
http://forums11.itrc.hp.com/service/...55048+28353475

All the best

Last edited by vbe; 05-05-2009 at 12:03 PM.. Reason: added hp forum example
# 12  
Old 05-05-2009
Thanks vbe, you explained it better than me.

I had assumed that the cron fired prematurely for a scheduled job later in May 2009 when it was actually left over from May 2008.
# 13  
Old 05-05-2009
Thanks Vbe.

So it's a quirk of cron ??

So If you specify the day & month in a cron entry, like 45 2 25 05 0 ... it will execute and re-execute again (not by your own design) on the first Sunday of the 5th month the following year.

Is that's a suitable summary of it ?

Cheers,
Cameron
# 14  
Old 05-07-2009
For me it would be:
all the sundays of 5th month AND the 25th day of that month

(let us know if it is true since I havent tried that variant yet... so for was "every first sunday of each month" and so had * instead of a value for month...)

I remembered struggles (long ago...) on trying to get "OR" ( execute the second thursday but at the latest on the 13th - some months having 2nd thursday on 14, if run on the 13th it should not on the 14th..., or on wednesdays when it falls the 10th...)
 
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