LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-28-2012, 09:20 PM   #1
sapeurcamembert
LQ Newbie
 
Registered: Feb 2012
Posts: 1

Rep: Reputation: Disabled
Exclamation Anacron jobs running twice a day and weekly jobs not running at all...


I am running Ubuntu 11.04 (fresh install) and I am using rsnaphot to take incremental backups. I am using my desktop time to time and decided to let the system takes the backup for me, using anacron.

Strangely enough rsnapshot as started by anacron is executing twice a day and weekly never been executed...

I am dealing with the same problem for a couple of weeks and decide to ask for help.

First anacron as supplied by 11.04 install (not changed)

# /etc/cron.d/anacron: crontab entries for the anacron package

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

#30 7 * * * root test -x /etc/init.d/anacron && /usr/sbin/invoke-rc.d anacron start >/dev/null
30 7 * * * root start -q anacron ||

Next crontab table (empty) everything is commented out

/etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
#17 * * * * root cd / && run-parts --report /etc/cron.hourly
#25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
#47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
#52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

Next anacrontab as set up

# /etc/anacrontab: configuration file for anacron

# See anacron( and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# These replace cron's entries
1 5 cron.daily nice run-parts --report /etc/cron.daily
7 10 cron.weekly nice run-parts --report /etc/cron.weekly
1 120 mysnap.daily /home/am/bin/mysnap.sh -v daily
7 180 mysnap.weekly /home/am/bin/mysnap.sh -v weekly
30 240 mysnap.monthly /home/am/bin/mysnap.sh -v monthly
@monthly 15 cron.monthly nice run-parts --report /etc/cron.monthly

Next mysnap.sh script (executed as root)

#!/bin/sh
# An Easy command to use the rsnapshot command.

period="daily"

if [ $# -eq 1 ] ; then
period=$1
fi

echo $period

/usr/bin/rsnapshot -v $period >> /var/log/rsnapshot

du -s -h /media/7444bkup -h >> /var/log/rsnapshot
ls -al /media/7444bkup/.snapshots/ >> /var/log/rsnapshot

# Send log to email

cat /var/log/rsnapshot | ssmtp sapeurcamembert@myemail

# Reset log after weekly processing

if [ $period -eq "weekly" } ; then
cat /dev/null > /var/log/rsnapshot
fi

The file /var/spool/anacron/cron.daily is updated with the time stamp (date only as usual) 20120228 as today

The file /var/log/rsnapshot is never reset....and the weekly period is never executed....

Any help will be appreciated.
 
  


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
[SOLVED] Cron jobs not running saldon Linux - Server 2 01-08-2010 10:01 AM
Running jobs when possible LasseBob Linux - General 2 04-14-2007 06:58 AM
keep jobs running server-solution Linux - Software 2 09-15-2005 04:49 AM
running asynchronous jobs Raptor Ramjet Linux - General 3 12-01-2004 02:49 AM
cron jobs not running scarr3d Linux - Software 7 05-25-2004 04:21 PM

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

All times are GMT -5. The time now is 03:44 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