From 775666c5b0ea751b6fc5db55b0264612ad116a0b Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 15 Nov 2018 12:34:37 +0100 Subject: [PATCH] ud-replicate: move from lockfile(1) to flock --- debian/changelog | 1 + ud-replicate | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 736ea09..d1dbe62 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ userdir-ldap (0.3.93) UNRELEASED; urgency=medium * Editorial edits to the salsa paragraph prepared by Joseph Herlant. * ud-replicate: remove chroot support as we no longer use historical dchroot. + * ud-replicate: move from lockfile(1) to flock. [ Ansgar Burchardt ] * ud-mailgate: include name of unknown host in error message diff --git a/ud-replicate b/ud-replicate index 26158b9..e06776c 100755 --- a/ud-replicate +++ b/ud-replicate @@ -37,7 +37,6 @@ tempfile2='' cleanup () { - rm -f lock rm -rf $tempdir rm -f $tempfile rm -f $tempfile2 @@ -49,9 +48,13 @@ HOST=`hostname -f` SYNCHOST=`ud-config synchost`; LOCALSYNCON=`ud-config localsyncon`; EMAILAPPEND=`ud-config emailappend`; -cd /tmp/ -cd /var/lib/misc || cd /var/state/glibc/ || cd /var/db/ -lockfile -r 1 -l 3600 lock +cd /var/lib/misc +exec 200< "." +if ! flock -w 60 -e 200; then + log "Cannot acquire lock on `pwd`" + exit 1 +fi + trap cleanup exit case $HOST in -- 2.20.1