SlackwareThis Forum is for the discussion of Slackware Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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 ?
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.
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.
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.
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 "~")?