The "stomp" and "git-poller" init.d scripts were in "templates/ubuntu"
but not in "templates/centos".

Under "templates/centos" these scripts need to source
"/etc/rc.d/init.d/functions" because they use the "failure" function,
and they need to have chkconfig information, so they must be
different from those in "templates/ubuntu".

Execution rights are added to the init.d scripts that did not have
them. And while at it some trailing whitespaces are removed.

Signed-off-by: Christian Couder <[email protected]>
---
 doc/templates/centos/git-poller      |  104 ++++++++++++++++++++++++++++++++++
 doc/templates/centos/stomp           |   98 ++++++++++++++++++++++++++++++++
 2 files changed, 202 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 doc/templates/centos/git-daemon
 create mode 100755 doc/templates/centos/git-poller
 mode change 100644 => 100755 doc/templates/centos/git-ultrasphinx
 create mode 100755 doc/templates/centos/stomp
 mode change 100644 => 100755 doc/templates/ubuntu/stomp

diff --git a/doc/templates/centos/git-daemon b/doc/templates/centos/git-daemon
old mode 100644
new mode 100755
diff --git a/doc/templates/centos/git-poller b/doc/templates/centos/git-poller
new file mode 100755
index 0000000..c5e3bb7
--- /dev/null
+++ b/doc/templates/centos/git-poller
@@ -0,0 +1,104 @@
+#!/bin/bash
+#
+# init file for Gitorious GIT-Poller daemon
+#
+# chkconfig: 2345 55 25
+# description: GIT-Poller server daemon
+#
+# processname: poller
+
+# Author: Antonio Marques <[email protected]>
+
+# source function library
+. /etc/rc.d/init.d/functions
+
+export RAILS_ENV=production
+GITORIOUS_HOME=/var/www/gitorious
+RETVAL=0
+GIT_POLLER="/usr/bin/ruby $GITORIOUS_HOME/script/poller"
+LOCK_FILE=/var/lock/git-poller
+PID_FILE=$GITORIOUS_HOME/tmp/pids/poller0.pid
+
+do_check_pid() {
+  if [ -f $PID_FILE ]; then
+    PID=`cat $PID_FILE`
+    RUNNING=`ps --pid $PID | wc -l`
+  else
+    PID=0
+    RUNNING=0
+  fi
+}
+
+runlevel=$(set -- $(runlevel); eval "echo $$#" )
+
+start()
+{
+  do_check_pid
+  if [ $RUNNING != 2 ] ; then
+    echo -n $"Starting $PROG:"
+    /bin/su - git -c "$GIT_POLLER start"
+    sleep 4
+    if [ -f $PID_FILE ] ; then
+      echo "Success"
+      RETVAL=0
+    else
+      echo "FAILURE"
+      RETVAL=1
+    fi
+RETVAL=$?
+  else
+    echo -n $"$PROG already running"
+    failure
+  fi
+  [ "$RETVAL" = 0 ] && touch $LOCK_FILE
+  echo
+}
+
+stop()
+{
+  do_check_pid
+  echo -n $"Stopping $PROG: "
+  if [ $RUNNING != 2 ] ; then
+    failure $"Stopping $PROG"
+  else
+    #killproc -p $PID_FILE
+    /bin/su - git -c "$GIT_POLLER stop"
+   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
+  fi
+  [ "$RETVAL" = 0 ] && rm -f $LOCK_FILE
+  echo
+}
+
+case "$1" in
+  start)
+    start
+    ;;
+  stop)
+    stop
+    ;;
+restart)
+stop
+start
+;;
+  condrestart)
+    if [ -f $LOCK_FILE ] ; then
+      if [ "$RETVAL" = 0 ] ; then
+        stop
+        # avoid race
+        sleep 5
+        start
+      fi
+    fi
+    ;;
+  *)
+    echo $"Usage: $0 {start|stop|restart|condrestart}"
+    RETVAL=1
+esac
+exit $RETVAL
+
diff --git a/doc/templates/centos/git-ultrasphinx 
b/doc/templates/centos/git-ultrasphinx
old mode 100644
new mode 100755
diff --git a/doc/templates/centos/stomp b/doc/templates/centos/stomp
new file mode 100755
index 0000000..f8b9496
--- /dev/null
+++ b/doc/templates/centos/stomp
@@ -0,0 +1,98 @@
+#!/bin/bash
+#
+# init file for stompserver
+#
+# chkconfig: 2345 55 25
+# description: stompserver daemon
+#
+# processname: stompserver
+
+# source function library
+. /etc/rc.d/init.d/functions
+
+RETVAL=0
+GITORIOUS_HOME=/var/www/gitorious
+STOMP="/usr/bin/ruby /usr/bin/stompserver -w $GITORIOUS_HOME/tmp/stomp -q file 
-s queue &> /dev/null &"
+LOCK_FILE=/var/lock/stomp
+PID_FILE=$GITORIOUS_HOME/tmp/stomp/log/stompserver.pid
+
+do_check_pid() {
+  if [ -f $PID_FILE ]; then
+    PID=`cat $PID_FILE`
+    RUNNING=`ps --pid $PID | wc -l`
+  else
+    PID=0
+    RUNNING=0
+  fi
+}
+
+runlevel=$(set -- $(runlevel); eval "echo $$#" )
+
+start()
+{
+  do_check_pid
+  if [ $RUNNING != 2 ] ; then
+    echo -n $"Starting $PROG:"
+    /bin/su - git -c "$STOMP"
+    sleep 4
+    if [ -f $PID_FILE ] ; then
+      echo "Success"
+      RETVAL=0
+    else
+      echo "Failure"
+      RETVAL=1
+    fi
+RETVAL=$?
+  else
+    echo -n $"$PROG already running"
+    failure
+  fi
+  [ "$RETVAL" = 0 ] && touch $LOCK_FILE
+  echo
+}
+
+stop()
+{
+  do_check_pid
+  echo -n $"Stopping $PROG: "
+  if [ $RUNNING != 2 ] ; then
+    failure $"Stopping $PROG"
+  else
+    killproc -p $PID_FILE
+  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
+  fi
+  [ "$RETVAL" = 0 ] && rm -f $LOCK_FILE
+  echo
+}
+
+case "$1" in
+  start)
+    start
+    ;;
+  stop)
+    stop
+    ;;
+restart)
+stop
+start
+;;
+  condrestart)
+    if [ -f $LOCK_FILE ] ; then
+      if [ "$RETVAL" = 0 ] ; then
+        stop
+        # avoid race
+        sleep 5
+        start
+      fi
+    fi
+    ;;
+  *)
+    echo $"Usage: $0 {start|stop|restart|condrestart}"
+    RETVAL=1
+esac
+exit $RETVAL
diff --git a/doc/templates/ubuntu/stomp b/doc/templates/ubuntu/stomp
old mode 100644
new mode 100755
-- 
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