LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-01-2008, 05:55 AM   #1
yusufs
Member
 
Registered: Oct 2007
Posts: 162

Rep: Reputation: 30
cron help


I want to have a cron which should run every hour.. and another cron to run within the next 30 secs after the first cron is executed.. how to have this ?


Thanks
Yusuf
 
Old 01-01-2008, 06:08 AM   #2
Zmyrgel
Senior Member
 
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 37
AFAIK cron only "understands" minutes. You could make the hourly script to sleep for 30sec and then run another script.
 
Old 01-01-2008, 07:29 AM   #3
centauricw
Member
 
Registered: Dec 2005
Location: Lawrenceville GA
Distribution: Slackware, CentOS. Red Hat Enterprise Linux
Posts: 216

Rep: Reputation: 31
True, because the cron daemon scans the crontab file only once a minute. A 30 second delay will have to be handled programmaticly.
 
Old 01-02-2008, 10:23 AM   #4
cconstantine
Member
 
Registered: Dec 2005
Distribution: RedHat, Ubuntu
Posts: 101

Rep: Reputation: 15
boolean short circuit in shell...

[QUOTE=yusufs;3007393]I want to have a cron which should run every hour.. and another cron to run within the next 30 secs after the first cron is executed.. how to have this ?

configure your crontab entry as

Code:
/some/dir/script1.sh && sleep 30 && /some/dir/script2.sh
the shell evaluates left-to-right to determine the result of the whole expression. If script1 exits non-zero, it won't do the sleep or scrip2.

-c
 
  


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 09:16 AM
cron file 000-delay.cron (it is on my FC5) - what is the purpose? jtmoon Linux - Server 1 03-08-2007 12:15 PM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 02:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 02:50 PM


All times are GMT -5. The time now is 09:10 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