X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Ffiles%2Fstatic-mirroring%2Fstaticsync-ssh-wrap;h=959b4f8f0df84dd186c8ed3e4b0654836cd38050;hb=7c041353f4da829d409830eba2e95946952e817f;hp=a4075471da3a9d7e83fe4d9908de61124fc40445;hpb=a3d0ee7754397443a449a5916e709ed0f8660ef1;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/files/static-mirroring/staticsync-ssh-wrap b/modules/roles/files/static-mirroring/staticsync-ssh-wrap index a4075471d..959b4f8f0 100755 --- a/modules/roles/files/static-mirroring/staticsync-ssh-wrap +++ b/modules/roles/files/static-mirroring/staticsync-ssh-wrap @@ -97,9 +97,13 @@ do_rsync_on_master() { elif [ "$*" = "$args $component/-live-/" ] || [ "$*" = "$args ./$component/-live-/" ] ; then local path="$BASEDIR/master/$component-current-live" info "host $remote_host wants $path, acquiring lock" - exec 200< "$path" + tgtlock="$BASEDIR/master/$component.lock" + if ! [ -e "$tgtlock" ]; then + touch "$tgtlock" + fi + exec 200< "$tgtlock" if ! flock -s -w 0 200; then - echo >&2 "Cannot acquire shared lock on $path - this should mean an update is already underway anyway." + echo >&2 "Cannot acquire shared lock on $tgtlock covering $path - this should mean an update is already underway anyway." exit 1 fi exec rsync $args "$path/."