summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmirmon-wrapper.sh3
1 files changed, 3 insertions, 0 deletions
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