SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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 ..
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 "~")?
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?
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.