Visit Our UNIX and Linux User Community


Cron schedule for ever other week


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Cron schedule for ever other week
# 1  
Old 07-23-2009
Cron schedule for ever other week

I have cron scheduing that after hotbackup omniback kicks in and back up tape.

00 17 * * * /usr/local/bin/archbakPRD/mainPRDbackup.sh > /usr/local/bin/archbakPRD/dbfcopy.log 2 >&1

above cron can fired every night at 5PM but omnibackup need to have seperate name for each backup ( i.e: PRD_backup_Mon_A, PRD_backup_Tue_A, etc )

Above is not a problem since all I have to do is

00 17 * * 1, 00 17 * * 2, 00 17 * * 3, 00 17 * * 4, etc with different day hardcoded in backp script.

============
Now My problem
============

we have two set of tape drive and rotate tapes inside. For example

1st and 3rd Monday we use PRD_backup_Mon_A

2nd and 4th Monday we use PRD_backup_Mon_B


I know I can create 8 set of cron schedule but how do I go about setting up the cron so that it will run every other Monday for "PRD_backup_Mon_A" and every other Monday for "PRD_backup_Mon_B"?

any help will be appreciated

Pau
# 2  
Old 07-23-2009
Hi.

Sadly, cron doesn't work in weeks, only days of the week and days of the month.

Perhaps you could have a single cronjob running every monday and make a minor change to your script?

Besides, you might have 5 Monday's in a month. Then what?

Crude example:
Code:
if [ -r next_backup_is_B ]; then
  set tape device to "PRD_backup_Mon_B"
  rm next_backup_is_B
else
  set tape device to "PRD_backup_Mon_A"
  touch next_backup_is_B
fi
(the rest of you script...)

Failing that perhaps more "intelligent" scheduling software could be used.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #227
Difficulty: Easy
According to NetMarketShare, in September 2019 BSD had a 0.01% global market share of the desktop computing market.
True or False?

10 More Discussions You Might Find Interesting

1. HP-UX

Help with cron schedule

Hope you can help with a queuy i have. Server OS is HP-UX my cron runs like this: * * * * * /test/scripts/1_min_jobs.sh 1>/dev/null 2>/dev/null 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /test/scripts/jobs_5mins.sh 1>/dev/null 2>/dev/null 0,15,30,45 * * * *... (10 Replies)
Discussion started by: davexxash
10 Replies

2. Shell Programming and Scripting

schedule a job without Cron

Hi All, Is there any way (any utility) to schedule a job to run once in a week on RedHat Linux ? Note- Do not using Crontab. Thanks Pravin (1 Reply)
Discussion started by: pravin27
1 Replies

3. UNIX for Dummies Questions & Answers

Schedule a cron job

Hi, Can anyone help me out with scheduling a cron job for the below: i wnated to delete file from a folder on every sunday at 05:00 AM this is code i have used. ******************************************************* 0 05 * * 0 find /abc/xyz/pqrs/bak/ -type f -mtime +30 -exec rm -f... (5 Replies)
Discussion started by: ch33ry
5 Replies

4. Linux

how to access schedule in cron/mks/w'

Hi, I need to work around 20 boxes to compile list of scheduled jobs on all of them, and these could be set in Linux RHat:cron, or Windows:MKS scheduler, or Windows:scheduler. Do you know how I can access those entries from script to have this whole list in sync, as we have it changed... (0 Replies)
Discussion started by: trento17
0 Replies

5. Shell Programming and Scripting

Schedule a Cron job

Hi all, I am new to cron jobs.. i wanted to schedule a cron job that wil send a mail to me at 3:00PM on 10th August ie is on Wednesday. 0 15 10 8 3 echo "message from UNIX here"|mail -s "your subject here" user@user.com However this was not executed... Can anyone please... (0 Replies)
Discussion started by: ch33ry
0 Replies

6. Shell Programming and Scripting

Schedule without cron

Hi, How to write the recursive function. I have a script, #!/usr/bin/ksh ## name=$1 outputfile='output.log' sqlplus -s > ${outputfile} <<__END__ ${USER}/${PASS}@${DB} WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK WHENEVER OSERROR EXIT FAILURE ROLLBACK SET ECHO ON SET SERVEROUTPUT... (3 Replies)
Discussion started by: sandy1028
3 Replies

7. Solaris

Prstat Cron Schedule

Hi , I am trying to set up a cron job for getting the prstats for every 10 minutes to a log file. prstat -s cpu -n 20 > a.txt The issue is when i try to execute this command, a.txt is filling up with data for every second which is not i wanted.I just need top 20 processes for every 10... (2 Replies)
Discussion started by: pyaranoid
2 Replies

8. Shell Programming and Scripting

unable to schedule in cron

the follwing script is running fine , when run from the ksh shell...it runs properly i.e. waits for a file "test.flag" and sends mail accordingly. But when I schedule it in the crontab ...it does not run at the specified time (it never runs). I am using ksh ####shell script starts count=1... (4 Replies)
Discussion started by: ace@123
4 Replies

9. UNIX for Dummies Questions & Answers

schedule many jobs using cron

HI, I need to schedule a no.of jobs using the cron facility. I currently do two kinds of scheduling,one based on the database load(after the database is loaded the program will start) and the other is based on time.....(say 10.00a.m daily) the problem is.......... When the database is loaded... (1 Reply)
Discussion started by: sireesha15
1 Replies

10. Shell Programming and Scripting

How to Schedule job using cron(URGENT)

Hello All, I m newbie to Job scheduling. Suppose i have 2 files s1.sh and s2.sh i want to make a schedule such as run s1.sh at 2AM everyday and run s2.sh 9Pm everyday. Can anyone tell me how to schdule that using CRON and i want to know what is CRON and CRONTAB. Thanks in advance (2 Replies)
Discussion started by: ravi.sadani19
2 Replies

Featured Tech Videos