LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cron - how to give priority to a task running in cron.daily? (http://www.linuxquestions.org/questions/linux-newbie-8/cron-how-to-give-priority-to-a-task-running-in-cron-daily-843218/)

MeeLee 11-09-2010 08:53 AM

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!

AlucardZero 11-09-2010 09:02 AM

well, logrotate is also in cron.daily for me. So, name your script such that it comes alphabetically after logrotate.

udaman 11-09-2010 09:10 AM

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.

MeeLee 11-09-2010 09:41 AM

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


All times are GMT -5. The time now is 03:23 AM.