Visit Our UNIX and Linux User Community


Scheduling bi-weekly through cron


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Scheduling bi-weekly through cron
# 1  
Old 09-13-2007
Scheduling bi-weekly through cron

Is there a way in AIX to schedule a script to run bi-weekly through cron?

I have a script that needs to run every other Wednesday, and this is what I thought I had to enter in the crontab file:
Code:
00 08 * * 3/2 /home/user/user.script

It didn't like that. It reports a syntax error. I'm almost positive that in Linux and/or Solaris something like that will work, or I may be totally off....Smilie

Any suggestions, would be greatly appreciated!

Thanks in advance!

Last edited by Yogesh Sawant; 12-31-2010 at 01:55 PM.. Reason: added code tags
# 2  
Old 09-13-2007
how about
Code:
00 08 1-7,15-21 * 3 /home/user/user.script

This should give you the 1st and 3rd web of every month.

Last edited by Yogesh Sawant; 12-31-2010 at 01:56 PM.. Reason: added code tags
# 3  
Old 09-13-2007
Thanks a bunch, daveisme!! You're the bomb...!! I'd never thought of that..!
# 4  
Old 09-14-2007
Quote:
Originally Posted by daveisme
how about
00 08 1-7,15-21 * 3 /home/user/user.script

This should give you the 1st and 3rd web of every month.
I think day of the week is an "or" rather than an "and". I've been bitten by this before. From the man page.
Quote:
This example

0 0 1,15 * 1

would run a command on the first and fifteenth of each
month, as well as on every Monday.
# 5  
Old 02-19-2009
Quote:
Originally Posted by LPT
Is there a way in AIX to schedule a script to run bi-weekly through cron?
Try this:
Code:
00 08 * * 3  [[ $(expr `date +%W` % 2) = 0 ]] && /home/user/user.script

depending on the bi-weekly cycle you may need a "= 1" instead.
# 6  
Old 02-20-2009
I guess it will run from 1-7 & 15-21, and every wednesday. so how does it go bi-weekly.

Previous Thread | Next Thread
Test Your Knowledge in Computers #708
Difficulty: Medium
The MySQL SELECT statement allows you to read data from only a single table.
True or False?

9 More Discussions You Might Find Interesting

1. Red Hat

Scheduling cron job

Hi Everybody, I want to run a script at every 5 seconds. I know how to run it every 5 minutes, is there any possibility to run a script at 5 seconds interval. Regards, Mastan (3 Replies)
Discussion started by: mastansaheb
3 Replies

2. UNIX for Dummies Questions & Answers

Cron confusion - scheduling a script

I have a script that backs up a directory, creates a log file and mails the log file to us. find . -print | backup -ivqf/dev/rmt0 | tee backup.log cat backup.log|mail -v -s "Tape backup log" maillist This script works fine from the console. When I schedule it in cron, I never get the... (1 Reply)
Discussion started by: landog
1 Replies

3. Shell Programming and Scripting

Cron Job Scheduling

Hi All, I have a script which is scheduled in the Cron. It runs every 10th and 40th min of an hour.The job has to run every 30min. But, I do not want to have the 00:10 MST run every day.Is it possible to exclude that run from the schedule?Or any other way through which i can run my job every... (4 Replies)
Discussion started by: sparks
4 Replies

4. UNIX for Dummies Questions & Answers

Scheduling tasks with cron in Slackware 12

How do I start, restart and stop the cron service under Slackware 12? (1 Reply)
Discussion started by: proactiveaditya
1 Replies

5. Shell Programming and Scripting

Scheduling Cron job-Problem

Hello All, I want to run a script for every 5 minutes interval.So i developed a script which has to be scheduled to run for every 5 minutes. That script internally runs another script. But the problem is it is not executing properly. Can anybody throw some light on this. Below are the code... (4 Replies)
Discussion started by: RSC1985
4 Replies

6. UNIX for Dummies Questions & Answers

Understanding cron scheduling command

Below are two cron entries. what is the difference beteeen writing 20 and */20? how is "20 * * * *" different from "*/20 * * * *"? 1) 20 * * * * find /tmp/ -name "*.log.*" ! -name "*.gz" -mmin +1440 -exec gzip '{}' \; 2) */20 * * * * find /tmp/ -name "*.tmp.*" ! -name "*.gz" -mmin +1440... (6 Replies)
Discussion started by: niks
6 Replies

7. HP-UX

cron scheduling?

Hi all, i want a job to run first monday of every of month. (1 Reply)
Discussion started by: megh
1 Replies

8. UNIX for Dummies Questions & Answers

scheduling tasks with cron

hello there, i'm learning about task scheduling with cron and all seems hyper exciting, yeppie. But there is a prob: assume i have a script that needed to be executed at 7am everyday. I could do: vi mycron 00 7 * * * echo hi mother, i wanna be a script daddy. :wq crontab mycron how... (4 Replies)
Discussion started by: alikun
4 Replies

9. UNIX for Advanced & Expert Users

cron job scheduling

Hi, How can I configure cron file , to execute a script on evey alternate saturdays ? I am using AIX 5.0 machine Thanks in advance Shihab (1 Reply)
Discussion started by: shihabvk
1 Replies

Featured Tech Videos