From f7d3f1a51ede1ed236e2b1a0c12b18fccd25de25 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 13 Oct 2011 13:17:11 +0200 Subject: [PATCH] improved --- scripts/manage-git-mirror.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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 } -- 2.45.2