LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-20-2012, 01:58 PM   #1
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Rep: Reputation: Disabled
crontab suggestion needed


Hi guys,

Kindly assist by suggesting what will be the correct crontab entry for the following scenario:-

I want to execute a script on coming 23 Sep (sunday) & after that i want to run the script every fortnight(14 days) on sunday at 5:30 am


I am not able to figure it out,,,, pls suggest


Thanks for your help
 
Old 09-20-2012, 02:08 PM   #2
TheMadIndian
Member
 
Registered: Dec 2007
Distribution: Fedora Slackware CentOS slax RHEL
Posts: 114

Rep: Reputation: 23
Quote:
Originally Posted by vicky007aggrwal View Post
Hi guys,

Kindly assist by suggesting what will be the correct crontab entry for the following scenario:-

I want to execute a script on coming 23 Sep (sunday) & after that i want to run the script every fortnight(14 days) on sunday at 5:30 am


I am not able to figure it out,,,, pls suggest


Thanks for your help
Post #3 or #4 in this link may help
http://www.linuxquestions.org/questi...4-days-725887/
 
Old 09-20-2012, 02:33 PM   #3
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
Thanks TheMadIndian for your prompt response.

But i didnt understand much from your provided link, it will be a great help if you can elaborate a bit


Thanks
 
Old 09-20-2012, 02:37 PM   #4
TheMadIndian
Member
 
Registered: Dec 2007
Distribution: Fedora Slackware CentOS slax RHEL
Posts: 114

Rep: Reputation: 23
Quote:
Originally Posted by vicky007aggrwal View Post
Thanks TheMadIndian for your prompt response.

But i didnt understand much from your provided link, it will be a great help if you can elaborate a bit


Thanks
Those posts show how to have something execute every 14 days, isn't that what you were looking for?
 
Old 09-20-2012, 03:37 PM   #5
hean01
LQ Newbie
 
Registered: Aug 2012
Location: Norrkoping, Sweden
Distribution: Fedora, Ubuntu, CentOS, RHEL
Posts: 23

Rep: Reputation: Disabled
As i understand you have a start date were something should start to execute every forthnight,
there are several ways to do this, either you create a script that updates your crontab to
run another script ever forthnight, the initial script can be sceduled with at command.

Another approach is to not touch the crontab at all and only use at command, something
in line with script below called myscript.sh, and the you have a myaction.sh that does
what you want to be doing evert forthnight.

Regards,

Henrik Andersson

Code:
#!/bin/bash
if [$# -eq 0]; then
  at 8am Sep 23 myscript.sh 1
else
  myaction.sh
  at 5:30am +14 days myscript.sh 1
fi

Last edited by hean01; 09-20-2012 at 03:39 PM.
 
Old 09-21-2012, 12:03 AM   #6
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
Thanks hen01 for responding.

But i want to use cron for scheduling my script first on 23 sep then after 23 sep i want to run every 14th day.

I believe using AT command we can schedule a job only once ..but i want to run my script whole year

Please suggeat
 
Old 09-21-2012, 02:05 AM   #7
hean01
LQ Newbie
 
Registered: Aug 2012
Location: Norrkoping, Sweden
Distribution: Fedora, Ubuntu, CentOS, RHEL
Posts: 23

Rep: Reputation: Disabled
As you can see in my script it does reschedule it self, it will work the way you want,
run the script without arguments it will rescedule itself with argument to run at 23 sep,
when executed with argument the script branches and execute myaction.sh and then
reschedule itself to run in 14 days.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Suggestion needed dahlia84 Linux - Certification 14 04-25-2009 12:08 AM
Partitioning suggestion needed! Completely Clueless Linux - General 2 12-07-2008 12:10 PM
Suggestion needed: squeezing the best out of a relatively old laptop Andramalech Linux - Distributions 1 03-30-2006 05:50 AM
Suggestion Needed miokhan General 10 02-25-2006 02:47 PM
infosec help and suggestion needed... logicalfuzz Linux - Security 1 12-24-2005 09:26 AM


All times are GMT -5. The time now is 01:03 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration