From 8f37aa42f6bef7baf73a4ecc0bc2caafd4e7e546 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Tue, 28 Apr 2020 23:39:18 -0700 Subject: wrapper: ensure locking Signed-off-by: Robin H. Johnson --- mirmon-wrapper.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mirmon-wrapper.sh b/mirmon-wrapper.sh index 4c5570b..4fffee0 100755 --- a/mirmon-wrapper.sh +++ b/mirmon-wrapper.sh @@ -33,6 +33,8 @@ main() { CONFFILE=$(readlink -f "${CONFDIR}"/mirmon.conf) VAR_GMIRRORS=${VARDIR}/g.mirrors EXTRA_MIRRORS=${CONFDIR}/g.mirrors.extra + # Lock outselves + [ "${FLOCKER}" != "$0" ] && exec env FLOCKER="$0" flock -en "${VARDIR}/flock" "$0" "${OPTS[@]}" || : # Grab mirrors from the web mkdir -p "${VARDIR}" "${HTDOCS}" || die "Failed to mkdir" @@ -148,4 +150,5 @@ done [[ $INVALID -eq 1 ]] && usage [[ $HELP -eq 1 ]] && dohelp +OPTS=( ${opts} ) # for flock main -- cgit v1.2.3-65-gdbad