Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-09-2010, 07:53 AM   #1
Registered: Aug 2009
Posts: 48

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


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:

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


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
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
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
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
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


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 > Forums > Linux Forums > Linux - Newbie

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

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