LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 08-21-2004, 01:59 AM   #1
rupesh_pulikool
LQ Newbie
 
Registered: Mar 2004
Location: 1/220 b.m.c colony malwani malad(w)
Posts: 10

Rep: Reputation: 0
schedule a crontab


Hi,
Please tell me how to schedule a crontab to run a script on every second
monday. Please help us with it.



Regards
Rupesh
 
Old 08-21-2004, 04:54 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Schedule it every monday (easy), then add a test in your script to skip one execution on two.
 
Old 08-23-2004, 07:05 AM   #3
rupesh_pulikool
LQ Newbie
 
Registered: Mar 2004
Location: 1/220 b.m.c colony malwani malad(w)
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks for ur reply,
But is it possible to schedule it with a single command
 
Old 08-23-2004, 07:17 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
If you mean with a single line in the crontab, I'm sure you can put a oneliner script here that does the test.

The patterns wouldn't do it alone and I see no way to have your requisite complied there.
The closest you can set is to have every monday that fall an even (or odd) day of month, but that wouldn't work well on every month change.
 
Old 08-23-2004, 07:40 AM   #5
elsheikhmh
Member
 
Registered: Aug 2004
Location: Cairo, Egypt
Distribution: Slackware
Posts: 101

Rep: Reputation: 15
well, add a static counter (with a record in a file) to the script. and let the desired code run only if the number is odd (or even).

1. read the counter from the file.
2. check if odd: run the code.
3. increment the counter.

run it weekly in the cron

mustafa
 
Old 08-23-2004, 11:07 AM   #6
rupesh_pulikool
LQ Newbie
 
Registered: Mar 2004
Location: 1/220 b.m.c colony malwani malad(w)
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks buddy
 
Old 09-03-2004, 01:32 AM   #7
sjspig
LQ Newbie
 
Registered: Mar 2003
Distribution: Modded-Knoppix
Posts: 23

Rep: Reputation: 15
I don't think there is a way to do exactly what you want with cron. You can do some of the suggestions listed or run it every 15th and 30th of the month or something similar - I'm guess this is definitely not what you want. You might find a way to determine which week it is and use the date output to determine if you want to run as well. If week is divisible by 2 with a remainder of 1 then run else don't. Hope this helps.
 
Old 09-04-2004, 09:32 PM   #8
rupesh_pulikool
LQ Newbie
 
Registered: Mar 2004
Location: 1/220 b.m.c colony malwani malad(w)
Posts: 10

Original Poster
Rep: Reputation: 0
No buddy,
I have tried with this on my linux servers were by putting a (" / ") you could achieve the same from cron
But i was searching, if the same could happen with on Sun Solaris server's.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
crontab schedule help onlykims Linux - Newbie 2 08-28-2004 12:09 PM
Schedule TOP command in Crontab. imsajjadali Red Hat 2 05-20-2004 04:12 AM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 12:35 PM
Schedule, AGAIN!! erathomor Linux - General 0 04-11-2002 11:25 AM
HOW TO Schedule erathomor Linux - General 3 04-10-2002 01:57 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 07:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration