You are not logged in.
Pages: 1
Hello,
I would like to know how can I run updatedb on a daily basis with anacron?
I have cron and anacron installed, the updatedb command is already in /etc/cron.daily and the anacrontab is set to run /etc/cron.daily on a daily basis. Yes, a updatedb script is inside /etc/cron.daily but I can't figure is how can I run anacron when I boot as a regular user since it is not a deamon and as I know it only starts at startup for the root user. Yes (again), anacrond is inside /etc/rc.d but the deamon (oh, after all there is a deamon?) seams not to run... or at least when I do something like: $locate something I get: locate: warning: database /var/lib/slocate/slocate.db' is more than 8 days old. What I need is to get the slocate.db automatically updated every day without the need to log as root and without the need to type any command. I believe there is something that is not working the way I expected or something I'm not doing well.
Thank's in advance for your help.
Last edited by DERA (2007-03-22 21:05:16)
DerA (pt_PT)
What one fool can do, another can. - Ancient Simian Proverb
Offline
What happens if you run anacron as root - do the jobs get done? You might want to post your anacrontab.
Unthinking respect for authority is the greatest enemy of truth.
-Albert Einstein
Offline
Thank's Snark.
Yes, if I run anacron as root with the beneath anacrontab the job gets done.
Since I've found that there is a anacrond in /etc/rc.d I've changed my anacrontab to this:
# /etc/anacrontab
SHELL=/bin/bash
# format: period delay job-identifier command
#1 10 cron.daily /usr/sbin/run-anacron /etc/cron.daily
#7 15 cron.weekly /usr/sbin/run-anacron /etc/cron.weekly
#30 20 cron.monthly /usr/sbin/run-anacron /etc/cron.monthly
1 10 updatedb /usr/bin/updatedb
But this was just for a test with updatedb since I meant to leave the cron.daily line uncommented to run either the logrotate, whatis and the shadow scripts inside /etc/cron.daily.
And It works, manually. Automatically it does not.
DerA (pt_PT)
What one fool can do, another can. - Ancient Simian Proverb
Offline
Put both anacrond and crond in your DAEMONS array of rc.conf. If your system is running when cron does its daily jobs, it will update the locate database. Otherwise, the db will be updated by anacron the next time you boot. That's what I do. Anacron only works at boot time; it checks what jobs needs to be done, does them then quits completely. To have daily jobs done by anacron, you'll need to restart the anacrond daemon manually or reboot the system on a daily basis. If you want to keep your system running for several days, use crond or both crond and anacrond.
Offline
Thank's Snowman!
The answer was to put the anacrond deamon on the proper place in /etc/rc.conf (crond was already there). It was easy after all and just in front of me. It works really fine.
Last edited by DERA (2007-03-22 21:11:10)
DerA (pt_PT)
What one fool can do, another can. - Ancient Simian Proverb
Offline
Pages: 1