| Summary: | periodic scripts do not run on desktop systems that aren't always on | ||
|---|---|---|---|
| Product: | Base System | Reporter: | kientzle |
| Component: | misc | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
State Changed From-To: open->closed This is the user's administrative problem. The user can change his cron job time as root. |
System periodic scripts are run from crontab in the wee hours of the morning. If the system isn't on all the time, those scripts never run. This causes a variety of problems: locate is useless, security checks are never performed, /tmp cleanup never happens, etc. Fix: The obvious workaround: leave the system on all the time. This is impossible for some (laptops), and undesirable for many others (electricity is getting more expensive). A more involved solution is to rewrite the 'periodic' program called by crontab so that: * It is run at frequent intervals. * It keeps a database recording when each periodic task was last run. * If the system is on at 2am (or some other preferred time), it will preferentially run periodic tasks at that time. Thus, servers and other always-on systems will have exactly the same behavior as before: all periodic tasks are run at a predictable time. * If a periodic task is significantly overdue (due to the system being off), then it will get run at other times at reduced priority. I've written a replacement for 'periodic' that does all of the above. It's written in Perl and is very nearly a drop-in replacement that provides the same user-land behavior as the standard 'periodic'. It would certainly make sense to have this revised periodic installed separately, though, since it does operate a bit differently. Full source available on request. How-To-Repeat: Turn off your computer at 5pm. Turn it back on at 9am and note that root has no email. ;-)