From: Thierry Parmentelat Date: Thu, 13 Oct 2011 07:46:57 +0000 (+0200) Subject: utility to manage git-mirror X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=e4341910b40aac630370a03cac672a7b1257b500;p=infrastructure.git utility to manage git-mirror --- 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 "$@"