+#!/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 "$@"