From e4341910b40aac630370a03cac672a7b1257b500 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 13 Oct 2011 09:46:57 +0200 Subject: [PATCH] utility to manage git-mirror --- scripts/manage-git-mirror.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 scripts/manage-git-mirror.sh diff --git a/scripts/manage-git-mirror.sh b/scripts/manage-git-mirror.sh new file mode 100755 index 0000000..6a18543 --- /dev/null +++ b/scripts/manage-git-mirror.sh @@ -0,0 +1,30 @@ +#!/bin/bash +COMMAND=$(basename $0) + +# avoid the crontab job for an hour +# wait until the running instance is done and create a void stamp +function stop () { + while true; do + echo -n . + ls /git-mirror/RUNNING_MIRROR >& /dev/null || { + touch /git-mirror/RUNNING_MIRROR + echo "OK, git-mirror stopped for an hour" + break + } + sleep 5 + done +} + +function start () { + rm /git-mirror/RUNNING_MIRROR +} + +function main () { + case $1 in + start) start;; + stop) stop;; + *) echo "Usage: $COMMAND start|stop";; + esac +} + +main "$@" -- 2.47.0