From: Peter Palfrader Date: Thu, 15 Nov 2018 11:34:37 +0000 (+0100) Subject: ud-replicate: move from lockfile(1) to flock X-Git-Tag: userdir-ldap-0.3.93~8 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=commitdiff_plain;h=775666c5b0ea751b6fc5db55b0264612ad116a0b;hp=d50247bd0ac0bf193b1f65a097e16af7b0ac87fa ud-replicate: move from lockfile(1) to flock --- 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