Merge pull request #421 from YunoHost/fix-1043-cron-dont-run-during-backup

[fix] Cron issue during custom backup
This commit is contained in:
Laurent Peuch 2018-02-08 03:46:23 +01:00 committed by GitHub
commit b055a41d04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1543,9 +1543,13 @@ class BackupMethod(object):
# Can create a hard link only if files are on the same fs
# (i.e. we can't if it's on a different fs)
if os.stat(src).st_dev == os.stat(dest_dir).st_dev:
os.link(src, dest)
# Success, go to next file to organize
continue
# Don't hardlink /etc/cron.d files to avoid cron bug
# 'NUMBER OF HARD LINKS > 1' see #1043
cron_path = os.path.abspath('/etc/cron') + '.'
if not os.path.abspath(src).startswith(cron_path):
os.link(src, dest)
# Success, go to next file to organize
continue
# If mountbind or hardlink couldnt be created,
# prepare a list of files that need to be copied