LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-11-2006, 08:33 PM   #1
rollo
Member
 
Registered: Apr 2004
Location: France
Distribution: Debian Sid (Kanotix)
Posts: 237

Rep: Reputation: 30
Bizarre Anacron permissions error


I'm having strange difficulty getting anacron to run. It's Apt-installed and "preconfigured" so normally I wouldn't need to fiddle with things on such a simple program. But check this out (from syslog of boot):


Code:
Nov 12 01:17:01 KanotixBox /USR/SBIN/CRON[5196]: (root) CMD (   run-parts --report /etc/cron.hourly)
Nov 12 01:18:41 KanotixBox anacron[5504]: Anacron 2.3 started on 2006-11-12
Nov 12 01:18:41 KanotixBox anacron[5504]: Can't open timestamp file for job cron.daily: Permission denied
Nov 12 01:18:41 KanotixBox anacron[5504]: Aborted
And, from the command line:

Code:
rollo@KanotixBox:~$ anacron -d
Anacron 2.3 started on 2006-11-12
anacron: Can't open timestamp file for job cron.daily: Permission denied
anacron: Aborted
I can chown the /var/spool/anacron directory and make it run - but just once, and this doesn't seem the right solution.

What could be going on here?
 
Old 11-12-2006, 01:12 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Are you running anacron as root?
 
Old 11-12-2006, 04:42 AM   #3
rollo
Member
 
Registered: Apr 2004
Location: France
Distribution: Debian Sid (Kanotix)
Posts: 237

Original Poster
Rep: Reputation: 30
How to run anacron at boot?

Quote:
Originally Posted by blackhole54
Are you running anacron as root?
No, I was trying not to do that - but of course, you're right, it must be run as root. So there is nothing bizarre about this at all!

But anacron still isn't running at boot. This seems to be because it is called by the cron.daily/weekly/monthly scripts... and these are scheduled for when the machine is switched off! Isn't this the problem that anacron was trying to solve?

So how do I get anacron to run only at startup? Putting it in /etc/rc5.d doesn't work - I guess because it's not a daemon.

This is all very strange. Normally anacron is supposed to "just work".
 
Old 11-12-2006, 11:17 AM   #4
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by rollo
But anacron still isn't running at boot. This seems to be because it is called by the cron.daily/weekly/monthly scripts... and these are scheduled for when the machine is switched off! Isn't this the problem that anacron was trying to solve?

So how do I get anacron to run only at startup? Putting it in /etc/rc5.d doesn't work - I guess because it's not a daemon.
By default anacron does fork to the background. But trying to run it directly from a runlevel directory will get it called with a start parameter which it probably wont't like! I believe the normal way to do this is to create a script which calls it and create a symlink in /etc/rc5.d to that script. Are you sure Debian doesn't already have such a script in /etc/init.d? You could also start it from your rc.local script.

FWIW, I have a system that is frequently down, running different distros/OS's etc where I have anacron called at startup and when coming out of suspend to make sure things get run and once a day from cron. This is how I run cron.daily. I did it this way because I found it annoying when cron.daily ran twice within a short period of time because cron doesn't know about anacron's timestamps. This way it is guaranteed to run once and only once a day.

Last edited by blackhole54; 11-12-2006 at 11:19 AM.
 
Old 11-13-2006, 11:44 AM   #5
rollo
Member
 
Registered: Apr 2004
Location: France
Distribution: Debian Sid (Kanotix)
Posts: 237

Original Poster
Rep: Reputation: 30
Thanks blackhole for the advice.

You're correct, anacron is in /etc/init.d. But the Debian apt installation doesn't seem to put any symlinks to it in the /etc/rc*.d directories. This seems strange to me, as the whole point of anacron is that it must run when the machine is turned on, and boot would seem a good place to start...

Anyway, I stuck the link into /etc/rc5.d, and it seems to be running now. However, I'm still suspicious that it has failed to start this way in the past, and (for anyone else struggling with this) there could be a reason: the bit of the anacron init.d script which checks that the laptop is plugged on so as not to drain the battery unnecessarily:

Code:
    if test -x /usr/bin/on_ac_power
    then
        /usr/bin/on_ac_power >/dev/null
        if test $? -eq 1
        then
          log_progress_msg "deferred while on battery power."
         log_end_msg 0
         exit 0
        fi
    fi
Apparently some laptops don't cooperate with that. Seems safe to comment it out if in doubt.

Thanks once more.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
anacron not running CarLash Mandriva 0 05-25-2005 08:36 PM
anacron startscript juli SUSE / openSUSE 2 05-01-2005 01:51 PM
Anacron problem sachinh Linux - General 0 02-09-2005 01:02 AM
Absolutely bizarre error when installing an .RPM!?!? black hole sun Linux - Software 10 08-11-2004 04:02 PM
bizarre error when adding a new mem stick fenderman11111 Linux - General 3 07-05-2004 06:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration