I used to run into problems on old equipment (old in 1997 already) running
the daily and weekly scripts early in the morning around the time I was
arriving at work.
find and conditional execution are one method available of checking the
age of the database.
#!/bin/ksh
/usr/bin/find /var/db/ \
-name locate.database \
! -ctime 7 \
&& \
echo "nice /usr/libexec/locate.updatedb" \
| /usr/bin/at now +1$(($RANDOM % 10)) minutes
I'm guessing that desktops stay on for a while.
One possible option is that the installation script asks IF /etc/rc.local
should also run the daily or weekly scripts if overdue then, if yes, asks
how long after startup the refreshing should begin.
Netbooks and notebooks are subject to too many strange situations to be
able to generalize a script that won't offend large numbers of users.
apm is in base and could keep the refresher script from running if there
is no battery
#!/bin/ksh
test 1 -eq `/usr/sbin/apm -a` && \
/usr/bin/find /var/db/ \
-name locate.database \
! -ctime 7 \
&& \
echo "nice /usr/libexec/locate.updatedb" \
| /usr/bin/at now +1$(($RANDOM % 10)) minutes
/Lars