Jacob Meuser wrote on Mon, Feb 01, 2010 at 05:55:28AM +0000:

> how about if cron keeps track of the time it was last able to successfully
> run a job.  then when cron starts, send an email for all jobs missed since
> that time?  or maybe just send an email to remind that daily/weekly/
> monthly was missed?

I don't think missing one job, or even missing a few, is a problem.
It's good enough to have the maintenance jobs running now and then.
But your idea to send reminders might help, let's tweak it a bit.

Some time ago, we discussed a potential maintenance(8) utility
and decided to postpone the idea until we find more uses.
Right here, maintenance(8) might help:

 1. At 1:30 AM daily,
    run "maintenance" without any arguments, which will
     - run daily(8)     unless it ran today
     - run security(8)  in any case
     - run weekly(8)    unless it ran this week
     - run monthly(8)   unless it ran this month

 2. Thirty minutes after reboot,
    run "maintenance quick", which will
     - run the cheap parts of security(8),
       maybe everything except the SUID checks
     - check whether weekly(8) is massively overdue,
       say last run more than three weeks ago
     - if it is, produce output asking to run "maintenance" manually,
       but do not suggest this more than once every ten days

Item 1 takes care of servers such that very little changes for them
and they almost never run into 2 (unless you reboot your server
on Saturday, January 1, at 1:00 AM).

On your notebook, if you are in the habit of running weekly(8)
manually once a week, very little changes for you - except that
you now type "maintenance" instead of "sh /etc/weekly", which
will cover daily(8) and monthly(8), too, and that you get daily
security(8) checks.  In case you dislike the latter, just remove
the respective line from the crontab(5).

On the other hand, in case you keep forgetting weekly(8), it will
remind you after three weeks, and then every ten days, until you
come round to running maintenance.

Maybe some people will develop a habit of typing "sudo maintenance"
on their workstation just before leaving for lunch.


When passing an argument to maintenance(8), it will run just that
single script unconditionally, e.g. "maintenance weekly".
As discussed previously, this will also support running local
maintenance scripts either manually or from cron(8), using
the daily(8) shell functions, mailing output when there is any.
Some people liked the idea and looked forward to using it.

Except honouring a new a MAILTO environment variable (default: root),
I don't think maintenance(8) needs any other options: KISS.

As a bonus, this will reduce code duplication and shorten the scripts.


P.S.
I agree with Owain to not teach apropos(1) and locate(1) any nagging.

Reply via email to