LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Possible Bug in Slackware 12 cron-handling ? (http://www.linuxquestions.org/questions/slackware-14/possible-bug-in-slackware-12-cron-handling-608038/)

hb950322 12-20-2007 01:43 AM

Possible Bug in Slackware 12 cron-handling ?
 
I have set up a straightforward backup-script in a Slackware 12 server and put this in /etc/cron.daily where it is performed every day at 4:46 a.m. I changed absolutely nothing from the Slackware standard installation.

The script works fine from the command-line, when finished I get a mail to my workstation .

The scripts in cron.daily are executed from the script /usr/bin/run-parts (written by P.V. himself), as to be seen by the 'crontab -l' command.

The backup script is definitely executed twice by crond, because I get two mails in the morning and errors occur, because a mobile disc is mounted at the start of the script and unmounted when finished. Both mails have the same timestamp (HH:MM), but must be executed just some (milli)seconds behind each other.

I can't figure out, why this is the case. Has anyone else made similar experience and figured out an solution ?

Greets
Henric

ledow 12-20-2007 02:51 AM

Not heard of that before. Are you sure the script doesn't do something stupid at the end? What happens if you login as root and just run the script directly (make sure you actually run the one that's in the cron folder?

You've not done things like put a symlink in there as well, or used a two-part script?

Additionally, check that you haven't played with root's crontab, or your particular users for that matter, because they are seen as seperate things and they might both be trying to do the runparts thing. There haven't been any cron updates to Slackware 12 since release that I can see, so it may be worthwhile loading up another "clean" slackware install (do it in a virtual machine like qemu or something, it'll only need a couple of gigs of space and with kqemu it'll be just as fast as doing it for real on the same computer) and using the same script on there to see if it happens.

Alien Bob 12-20-2007 03:54 AM

Does your server's clock run too fast and is it's time set backwards regularly syncing it to a NTP server?
That could explain your issue - if the computer's time gets set back far enough just after the first job started, the job's scheduled start time may actually occur twice.

Eric

ledow 12-20-2007 06:38 AM

Running ntpd should counteract anything like that. However regular ntpdate's could cause that problem, yes, because it'll just correct the clock "all-at-one", but ntpd should be smart enough to adjust in tiny increments so that such "jumps" don't happen. Even then, it shouldn't be happening so regularly or on such a fine scale - I have ntpd on unreliable clocks and I've never had that problem. If it is that, though, and I'm wrong, it's probably better to make the script non-reentrant instead of turning ntpd off - a simple "have I run in the last minute" check should suffice.

hb950322 12-21-2007 02:24 AM

No ntpd running
 
Thanks a lot for your efforts an hints.

First:

ntpd is not running, so from this side I don't see an influence for this issue.

Second:

The scripts works perfect from the command-line as root, executed with

/etc/cron.daily/backup

and there are no links or other stuff there. The script itself does no background-processing, which could cause some strange behaviour, it goes line by line.

Third:

No crontab at all has been manipulated, it's all basic install.


But: It is a Dual-Core SMP System. I have no knowledge if this can cause problems.

Over christmas I will set up the same system on a "normal" Athlon 3000 and put the same script in place. Let's see what comes up then ..

Greets
Henric

regis_n_bits 12-21-2007 11:49 AM

The run-parts script will execute all script files found in the cron.daily directory. Is it possible that you have two copies of the same script in this directory? Or maybe even a backup copy of your script (i.e. a file ending in "~")?

Alien_Hominid 12-22-2007 12:32 AM

And this is very possible if you edit files with kate.

gilead 12-22-2007 01:32 AM

I don't see that behaviour here, either. Can you please post the errors that you get and the script contents? Are you getting two copies of the backup or errors due to files already existing?

hb950322 12-23-2007 02:38 AM

No Backup copies
 
I've had backup copies there and also thought to get the reason. But this is not the case. run-parts does not execute this scripts, as you can see by reading the sourcecode. I removed them either.

As I explained before, the script works perfekt from command-line without errors.

I'm in the winter-holliday now for two weeks. I'll put this script directly in the crontab, without run-parts and remove it from cron.daily. We will see what happens.

Thanks a lot to all

Greets
Henric


All times are GMT -5. The time now is 03:22 PM.