X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=scripts%2Fmanage-git-mirror.sh;h=78489ecdc969d885b3d29ae034c758c634706b73;hb=a8aa1baef6f4d1df60f44d1d542912acff913226;hp=220bc575067e715ec117202f0c1b748541180324;hpb=f7d3f1a51ede1ed236e2b1a0c12b18fccd25de25;p=infrastructure.git diff --git a/scripts/manage-git-mirror.sh b/scripts/manage-git-mirror.sh index 220bc57..78489ec 100755 --- a/scripts/manage-git-mirror.sh +++ b/scripts/manage-git-mirror.sh @@ -6,8 +6,8 @@ COMMAND=$(basename $0) function stop () { while true; do echo -n . - ls /git-mirror/RUNNING_MIRROR >& /dev/null || { - touch /git-mirror/RUNNING_MIRROR + ls /git-mirror/LOCK >& /dev/null || { + touch /git-mirror/LOCK echo "OK, git-mirror stopped for an hour" break } @@ -19,8 +19,8 @@ function start () { if pgrep git-mirror >& /dev/null; then echo "git-mirror instance is running" else - echo "Cleaned RUNNING_MIRROR" - rm /git-mirror/RUNNING_MIRROR + echo "Cleaned LOCK" + rm /git-mirror/LOCK fi } @@ -33,7 +33,19 @@ function status () { echo "No running instance of git-mirror" fi echo "Lock file status" - ls -l /git-mirror/RUNNING_MIRROR + ls -l /git-mirror/LOCK +} + +function clean () { + totrash=$(ls /git-mirror/*/NOTIFIED 2> /dev/null) + if [ -z "$totrash" ] ; then + echo "No NOTIFIED file found" + else + echo "Trashing the following files" + ls -l $totrash + rm -f $totrash + echo Done + fi } function main () { @@ -41,6 +53,7 @@ function main () { start) start;; stop) stop;; status) status;; + clean) clean;; *) echo "Usage: $COMMAND start|stop";; esac }