improved
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 13 Oct 2011 11:17:11 +0000 (13:17 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 13 Oct 2011 11:17:11 +0000 (13:17 +0200)
scripts/manage-git-mirror.sh

index 6a18543..220bc57 100755 (executable)
@@ -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
 }