LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 11-09-2010, 07:53 AM   #1
MeeLee
Member
 
Registered: Aug 2009
Posts: 48

Rep: Reputation: 3
cron - how to give priority to a task running in cron.daily?


Hello,

I have two custom tasks running daily. How do you give priority to one over the other?

One of them is configured via the logrotate.conf. The other sits directly in cron.daily.

The logrotate script checks for a certain file and:

ifempty
daily
create **** root utmp
rotate 1
prerotate
file > /var/log/fileToWriteTo
chmod *** /var/log/fileToWriteTo

endscript

I'd like the one in cron.daily to run after the script that is in logrotate.

Please can you advise how to do this...

Many thanks in advance!
 
Old 11-09-2010, 08:02 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,630

Rep: Reputation: 519Reputation: 519Reputation: 519Reputation: 519Reputation: 519Reputation: 519
well, logrotate is also in cron.daily for me. So, name your script such that it comes alphabetically after logrotate.
 
Old 11-09-2010, 08:10 AM   #3
udaman
Member
 
Registered: Oct 2010
Location: New England, USA
Distribution: OpenSUSE/Slackware64/RHEL/Mythbuntu
Posts: 187

Rep: Reputation: 39
logrotate is in cron.daily on my system, also. You could rename logrotate to "00-logrotate" and name your script to "01-my_script_name" and see if that works.
 
Old 11-09-2010, 08:41 AM   #4
MeeLee
Member
 
Registered: Aug 2009
Posts: 48

Original Poster
Rep: Reputation: 3
Ah. Ok - thank you.

I've had not seen your replies, so actually did it myself in a round about way (I think)

Basically created a new directory called scripts and then put the desired script in there.

Then, did a crontab -e

and appended to it:

0 7 * * * /pathToScript

When you do a crontab -l it comes up as above.

A bit more faff than what you've suggested,but will that work okay? (as in run daily at 7am?)

Many Thanks
 
  


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
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
cron hourly, daily, cron.d jobs don't execute eggsmartha Linux - General 3 09-17-2007 06:37 PM
cron.daily, cron.weekly not working mwhite74 Linux - Server 2 06-07-2007 09:51 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 01:50 PM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 02:30 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration