Signed-off-by: Christian Couder <[email protected]>
---
 doc/templates/ubuntu/git-poller |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/doc/templates/ubuntu/git-poller b/doc/templates/ubuntu/git-poller
index 736fa93..e534958 100755
--- a/doc/templates/ubuntu/git-poller
+++ b/doc/templates/ubuntu/git-poller
@@ -20,6 +20,9 @@ LOCK_FILE=/var/lock/git-poller
 PID_FILE=$GITORIOUS_HOME/tmp/pids/poller0.pid
 export RAILS_ENV=production
 
+# Source lsb functions for killproc
+. /lib/lsb/init-functions
+
 do_check_pid() {
   if [ -f $PID_FILE ]; then
     PID=`cat $PID_FILE`
@@ -36,7 +39,7 @@ start()
 {
   do_check_pid
   if [ $RUNNING != 2 ] ; then
-    echo -n $"Starting $PROG:"
+    echo -n "Starting $PROG: "
     /bin/su - git -c "$GIT_POLLER start"
     sleep 4
     if [ -f $PID_FILE ] ; then
@@ -46,10 +49,9 @@ start()
       echo "FAILURE"
       RETVAL=1
     fi
-RETVAL=$?
   else
-    echo -n $"$PROG already running"
-    failure
+    echo -n "$PROG already running"
+    RETVAL=1
   fi
   [ "$RETVAL" = 0 ] && touch $LOCK_FILE
   echo
@@ -58,21 +60,27 @@ RETVAL=$?
 stop()
 {
   do_check_pid
-  echo -n $"Stopping $PROG: "
+  echo -n "Stopping $PROG: "
   if [ $RUNNING != 2 ] ; then
-    failure $"Stopping $PROG"
+    echo "$PROG was not properly running"
+    RETVAL=1
   else
     #killproc -p $PID_FILE
     /bin/su - git -c "$GIT_POLLER stop"
-   sleep 4
+    RETVAL=$?
+    sleep 4
   fi
-  RETVAL=$?
   # if we are in halt or reboot runlevel kill all running sessions
   # so the TCP connections are closed cleanly
   if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
-   killproc -p $PID 2>/dev/null
+    killproc -p $PID 2>/dev/null
+  fi
+  if [ "$RETVAL" = 0 ] ; then
+    rm -f $LOCK_FILE
+    echo "Success"
+  else
+    echo "FAILURE"
   fi
-  [ "$RETVAL" = 0 ] && rm -f $LOCK_FILE
   echo
 }
  
@@ -98,7 +106,7 @@ start
     fi
     ;;
   *)
-    echo $"Usage: $0 {start|stop|restart|condrestart}"
+    echo "Usage: $0 {start|stop|restart|condrestart}"
     RETVAL=1
 esac
 exit $RETVAL
-- 
1.7.4.1.42.g43f9f 
 
*******************************
This e-mail contains information for the intended recipient only. It may 
contain proprietary material or confidential information. If you are not the 
intended recipient you are not authorised to distribute, copy or use this 
e-mail or any attachment to it. Murex cannot guarantee that it is virus free 
and accepts no responsibility for any loss or damage arising from its use. If 
you have received this e-mail in error please notify immediately the sender and 
delete the original email received, any attachments and all copies from your 
system.

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]

Reply via email to