[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Unidentified subject!

On Wed, 15 May 1996, Gerry Jensen wrote:

> Does anyone know of an easy way to make it so that 
> cron.daily/weekly/monthly jobs get executed even if the system is not on 
> at the specified time?
> For instance, I typically only run my home system an hour or two per 
> day.  How could I make it so that the first time I boot my system each 
> day, /etc/cron.daily jobs gets run, the first time I boot each week that 
> /etc/cron.weekly gets run, and the first time I boot at the beginning of 
> a new month that /etc/cron.monthly gets run?  As it is now, these almost 
> never get run unless I do it manually.
> Thanks,
> Gerry
> gerry@blue.intele.net

Try running a script like this out of your crontab (say once an hour).  It
should run things every day.  Even better, " date +%s > /var/local/today "
could be put in a script in /etc/cron.daily and this would then run only if
the regular mechanisms didn't.

Week and month scripts are left as an exercise :)

if [ ! -f /var/local/today ]
  # this will cause it to run if the time-file disappears.
  date -d "2 day ago" +%s > /var/local/today
  exit 0

if [ `date -d "1 day ago" +%s` -gt `cat /var/local/today` ]
  date +%s > /var/local/today
  run-parts /etc/cron.daily

So you think you know the real meaning of fear?
Yeah, you think you do know, but I doubt it.
When you sit in a shelter with bombs falling all over.
And the houses around you are burning like torches.
I agree that you experience horror and fright
For such moments are dreadful, for as long as they last,
But the all-clear sounds--then it's okay--          |  -- Ilya Selvinskiy
You take a deep breath, the stress has passed by.   | (Taken from "The Sum
But real fear is a stone deep down in your chest.   |   of All Fears" by
You hear me?  A stone.  That's what it is, no more. | Tom Clancy pg. 182.)

Reply to: