From: Thierry Parmentelat Date: Thu, 13 Oct 2011 11:17:11 +0000 (+0200) Subject: improved X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=f7d3f1a51ede1ed236e2b1a0c12b18fccd25de25;p=infrastructure.git improved --- diff --git a/scripts/manage-git-mirror.sh b/scripts/manage-git-mirror.sh index 6a18543..220bc57 100755 --- a/scripts/manage-git-mirror.sh +++ b/scripts/manage-git-mirror.sh @@ -16,13 +16,31 @@ function stop () { } function start () { - rm /git-mirror/RUNNING_MIRROR + if pgrep git-mirror >& /dev/null; then + echo "git-mirror instance is running" + else + echo "Cleaned RUNNING_MIRROR" + rm /git-mirror/RUNNING_MIRROR + fi +} + +function status () { + pids=$(pgrep git-mirror) + if [ -n "$pids" ] ; then + echo "Active processes" + ps $pids + else + echo "No running instance of git-mirror" + fi + echo "Lock file status" + ls -l /git-mirror/RUNNING_MIRROR } function main () { case $1 in start) start;; stop) stop;; + status) status;; *) echo "Usage: $COMMAND start|stop";; esac }