-   SUSE / openSUSE (
-   -   anacron startscript (

juli 04-30-2005 11:11 AM

anacron startscript
im working with suse 9.1 and I have organized my backups with cron. As the PC is not running 24/7 I would like to use anacron to catch up the missing jobs.
When I start anacron manually with


/usr/sbin/anacron -t /etc/anacrontab
the var/log/messages shows:


Apr 30 15:42:53 dhcppc0 anacron[8932]: Anacron 2.3 started on 2005-04-30
Apr 30 15:42:53 dhcppc0 anacron[8932]: Will run job `cron.daily' in 5 min.
Apr 30 15:42:53 dhcppc0 anacron[8932]: Will run job `cron.weekly' in 10 min.
Apr 30 15:42:53 dhcppc0 anacron[8932]: Will run job `cron.monthly' in 15 min.

But the scripts in cron.daily, cron.weekly and cron.monthly are not getting started, not even when
I remove the timestamps in /var/spool/anacron and the timestamps cron is using in /var/spool/cron/lastrun as well. No effect what so ever.

My crontab:



-*/3 * * * *  root  test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null 2>&1
47 12  * * *    root  rm -f /var/spool/cron/lastrun/cron.daily
30 17  * * 5    root  rm -f /var/spool/cron/lastrun/cron.weekly
00 18  29 4 *    root  rm -f /var/spool/cron/lastrun/cron.monthly

My anacrontab:



1        5        cron.daily      /etc/cron.daily
3        10        cron.weekly      /etc/cron.weekly
27        15        cron.monthly    /etc/cron.monthly

Has anybody an idea how to trigger the scripts with anacron. And another thing I am struggling with is, how to get anacron started at boot time as root. I have noticed that some distributions offer to start anacron by using the runlevel editor, but SuSE doesen't.

With best regards and thanks in advanced

abisko00 05-01-2005 12:25 PM

I am not familar with anacron, but what I understood from the documentation, anacrontab needs to contain scheduled commands. But /etc/cron.xy are directories. My guess would be that you have to address the cron script directly.

juli 05-01-2005 02:51 PM

The thing is, that the most distributions are using the program run-parts to get the scripts in the cron.daily directory executed.

02 4 * * * root run-parts /etc/cron.daily
SuSE comes with its own solution using run-crons, for example:

-*/5 * * * *  root  test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null  2>&1
00 17  * * *    root  rm -f /var/spool/cron/lastrun/cron.daily

These lines fetch the scripts in the cron.daily directory at 17:00 h and get them executed.
Anacron, another little program - is watching, if there are some jobs left behind because the computer was not running for a day or so. My problem was, that I coudn't get anacron to do that job.
Thanks to @rshaw's post
I could get anacron up and running correctly at boot time and everything is working fine right now.

All the best

All times are GMT -5. The time now is 10:18 PM.