summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2020-04-28 23:39:18 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2020-04-28 23:39:18 -0700
commit8f37aa42f6bef7baf73a4ecc0bc2caafd4e7e546 (patch)
tree396a9c3043fd90be63c768024b98200a46aa22c8
parenthtdocs: throw in a shiny frontpage (diff)
downloadgentoo-mirrorstats-8f37aa42f6bef7baf73a4ecc0bc2caafd4e7e546.tar.gz
gentoo-mirrorstats-8f37aa42f6bef7baf73a4ecc0bc2caafd4e7e546.tar.bz2
gentoo-mirrorstats-8f37aa42f6bef7baf73a4ecc0bc2caafd4e7e546.zip
wrapper: ensure locking
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-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