You are not logged in.

#1 2010-10-12 22:53:36

shaurz
Member
Registered: 2004-02-02
Posts: 358

cron has gone insane

I have a daily backup job which used to run just fine. But now when cron starts running the job, it re-runs it every 10 minutes after. Obviously the long backup job overlaps with the others started after it and it causes all sorts of problems. When I last checked it was running 11 copies of the backup process! I had to kill them all manually. What the hell is going on?

Offline

#2 2010-10-12 22:57:09

lagagnon
Member
From: an Island in the Pacific...
Registered: 2009-12-10
Posts: 1,087
Website

Re: cron has gone insane

Show us the cron file and the script it is running.


Philosophy is looking for a black cat in a dark room. Metaphysics is looking for a black cat in a dark room that isn't there. Religion is looking for a black cat in a dark room that isn't there and shouting "I found it!". Science is looking for a black cat in a dark room with a flashlight.

Offline

#3 2010-10-12 23:00:54

shaurz
Member
Registered: 2004-02-02
Posts: 358

Re: cron has gone insane

I just have a symlink in /etc/cron.daily to the backup script, which looks like this:

#!/bin/bash

rm -f /mnt/storage1/system.tar.gz
tar czf /mnt/storage1/system.tar.gz /bin /boot /etc /home /lib /lib64 /opt /root /sbin /srv /usr /var/log

python /home/shaurz/syncdirs.py /mnt/storage1 /mnt/storage1_backup --commit --logfile=/home/shaurz/backup1.log &
job1=$!

python /home/shaurz/syncdirs.py /mnt/storage2 /mnt/storage2_backup --commit --logfile=/home/shaurz/backup2.log &
job2=$!

wait $job1
wait $job2

sync

Offline

#4 2010-10-12 23:06:14

shaurz
Member
Registered: 2004-02-02
Posts: 358

Re: cron has gone insane

By the way, this is dcron and there is no crontab

Offline

#5 2010-10-12 23:08:00

toofishes
Developer
From: Chicago, IL
Registered: 2006-06-06
Posts: 602
Website

Re: cron has gone insane

shaurz wrote:

By the way, this is dcron and there is no crontab

There most definitely should be. Those directories aren't magic.

$ sudo crontab -l -u root
# root crontab
# DO NOT EDIT THIS FILE MANUALLY! USE crontab -e INSTEAD

# man 1 crontab for acceptable formats:
#    <minute> <hour> <day> <month> <dow> <tags and command>
#    <@freq> <tags and command>

# SYSTEM DAILY/WEEKLY/... FOLDERS
@hourly         ID=sys-hourly   /usr/sbin/run-cron /etc/cron.hourly
@daily          ID=sys-daily    /usr/sbin/run-cron /etc/cron.daily
@weekly         ID=sys-weekly   /usr/sbin/run-cron /etc/cron.weekly
@monthly        ID=sys-monthly  /usr/sbin/run-cron /etc/cron.monthly

Offline

#6 2010-10-12 23:12:18

shaurz
Member
Registered: 2004-02-02
Posts: 358

Re: cron has gone insane

Well it worked without a crontab (the package does not include a default one).

I ran sudo crontab -l -u root and got the same output:

# root crontab
# DO NOT EDIT THIS FILE MANUALLY! USE crontab -e INSTEAD

# man 1 crontab for acceptable formats:
#    <minute> <hour> <day> <month> <dow> <tags and command>
#    <@freq> <tags and command>

# SYSTEM DAILY/WEEKLY/... FOLDERS
@hourly         ID=sys-hourly   /usr/sbin/run-cron /etc/cron.hourly
@daily          ID=sys-daily    /usr/sbin/run-cron /etc/cron.daily
@weekly         ID=sys-weekly   /usr/sbin/run-cron /etc/cron.weekly
@monthly        ID=sys-monthly  /usr/sbin/run-cron /etc/cron.monthly

But the /etc/crontab file doesn't exist... is it stored somewhere else?

Last edited by shaurz (2010-10-12 23:16:24)

Offline

#7 2010-10-12 23:16:02

Dogmeat
Member
From: Slovak Republic
Registered: 2009-02-24
Posts: 193

Re: cron has gone insane

dcron contains /var/spool/cron/root what is a default crontab.

Offline

#8 2010-10-12 23:40:12

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,543

Re: cron has gone insane

https://bugs.archlinux.org/task/18681

To work around the bug I modified root's crontab as follows

40 * * * *       /usr/sbin/run-cron /etc/cron.hourly
15 0 * * *       /usr/sbin/run-cron /etc/cron.daily
30 2 * * 0       /usr/sbin/run-cron /etc/cron.weekly
20 4 1 * *       /usr/sbin/run-cron /etc/cron.monthly

# SYSTEM DAILY/WEEKLY/... FOLDERS
#@hourly         ID=sys-hourly   /usr/sbin/run-cron /etc/cron.hourly
#@daily          ID=sys-daily    /usr/sbin/run-cron /etc/cron.daily
#@weekly         ID=sys-weekly   /usr/sbin/run-cron /etc/cron.weekly
#@monthly        ID=sys-monthly  /usr/sbin/run-cron /etc/cron.monthly

Last edited by skunktrader (2010-10-12 23:43:07)

Offline

#9 2010-10-13 00:47:12

shaurz
Member
Registered: 2004-02-02
Posts: 358

Re: cron has gone insane

Thanks for the workaround, I should have checked the bug tracker first.

Offline

Board footer

Powered by FluxBB