Re: Cron sometimes starts two jobs from the same crontab entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/04/2020 09:25, Iosif Fettich wrote:
Hi,

On 2020-04-07 14:07, Terry Barnaby wrote:
I have a simple backup system that starts off a backup once per night during the weekdays. There is a crontab file in /etc/cron.d with the following entries:

################################################################################
# Beam Bbackup cron setup               Backup to ...
################################################################################
#
# Min Hour Day Month WeekDay

# Perform incremental backup to every work day
01 23 * * 1 root /src/bbackup/bbackup-beam
01 23 * * 2 root /src/bbackup/bbackup-beam
01 23 * * 3 root /src/bbackup/bbackup-beam
01 23 * * 4 root /src/bbackup/bbackup-beam
01 23 * * 5 root /src/bbackup/bbackup-beam

This system has been in use for 10 years or more on various Fedora versions. However about 18 months ago I have seen a problem where cron will start two backups with identical start times occasionally.

I have had to add a file lock system in the bbackup-beam to cope with this.

Any idea on why cron might start the same job off twice at the same time ? Could there be a time change issue with chronyd ?

Are you sure that the jobs you saw started *twice*...?

If one of the jobs would not finish till next launch time, maybe just hanging around due to some error, you'll end up with multiple jobs out there, despite the fact that they started days apart.

Another possible issue might be the daylight saving time. If you're using a non-UTC timezone, there are datetimes that repeat or that are missing. 23:01 seems not to be among them, but what do I know...

Same thing might happen if there are periodical bigger time adjustements (NTP, manual, ...).

If it happens more than once that the system time is 23:01, launching the script each time is not only legit, but actually mandatory.

Best regards,

Iosif Fettich

I am pretty sure two jobs are started at the same time. The backup script. that is run. writes some logging text to a log file with the datetime it started. I see two entries with the same datetime and without the file lock the backups get messed up due to two operating at once. This "fault" has happened about 4 times in the last year.

I have assumed the system time is always UTC synchronised using chronyd. The servers user code is running under the GMT timezone. I was wondering if the tweaking of the time by chronyd could cause this issue, but I would have thought this situation would have been handled by crond if this could happen and I have seen this issue about 4 times in a year, so it is not a totally sporadic event.

Terry

_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux