<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,7 @@
 == 0.9.9
 * remove dependency on SyslogLogger so that starling works on windows.
 * fix config file loading so relative paths are expanded properly &lt;jacob@jacobatzen.dk&gt;
+* clean up redhat init.d script &lt;gaffneyc@gmail.com&gt;
 
 == 0.9.8
 * add fix to enable relative paths &lt;david@motorator.com&gt;</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -1,63 +1,66 @@
 #!/bin/bash
 #
+# Make sure the /var/run/starling, /var/log/starling and /var/spool/starling
+# all exist and are owned by starling:starling
+#
 # starling    This shell script takes care of starting and stopping
 #                    the starling server
 # chkconfig: 345 98 98
 # description: The starling queue server
+# processname: starling
+# pidfile: /var/run/starling/starling.pid
+# logfile: /var/log/starling/starling.log
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Source networking configuration.
+[ -f /etc/sysconfig/network ] &amp;&amp; . /etc/sysconfig/network
+
+DUSER=starling
+DGROUP=starling
+LOGFILE=/var/log/starling/starling.log
+SPOOLDIR=/var/spool/starling
+PORT=22122
+LISTEN=0.0.0.0
+PIDFILE=/var/run/starling/starling.pid
 
-#determine where the 'pidof' executable is located
-if [ -e /bin/pidof ]; then
-  PIDOF=&quot;/bin/pidof&quot;
-elif [ -e /sbin/pidof ]; then
-  PIDOF=&quot;/sbin/pidof&quot;
-elif [ -e /usr/local/bin/pidof ]; then
-  PIDOF=&quot;/usr/local/bin/pidof&quot;
-elif [ -e /bin/pgrep ]; then
-  PIDOF=&quot;/bin/pgrep&quot;
-elif [ -e /usr/bin/pgrep ]; then
-  PIDOF=&quot;/usr/bin/pgrep&quot;
-elif [ -e /usr/local/bin/pgrep ]; then
-  PIDOF=&quot;/usr/local/bin/pgrep&quot;
-else
-  echo &quot;Could not find pidof or pgrep&quot;
-fi
-
-PROGDIR=&quot;/usr/bin&quot;
-PROGNAME=&quot;starling&quot;
-OPTIONS=&quot;-u nobody -g nobody -L /var/log/starling.log -q /var/spool/starling&quot;
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+NAME=starling
+INSTALL_DIR=/usr/local/bin
+DAEMON=$INSTALL_DIR/$NAME
+OPTS=&quot;-h $LISTEN -p $PORT -d -q $SPOOLDIR -P $PIDFILE -L $LOGFILE -u $DUSER -g $DGROUP&quot;
 
 start() {
-  pid=`$PIDOF $PROGNAME`
-  if [ &quot;$pid&quot; != &quot;&quot; ]; then
-    echo &quot;$PROGDIR$PROGNAME already running: $pid&quot;
-  else
-    echo &quot;Starting $PROGDIR$PROGNAME&quot;
-    cd $PROGDIR
-    nohup $PROGDIR$PROGNAME $OPTIONS &amp;
-  fi
+  echo -n $&quot;Starting starling: &quot;
+
+  daemon --pidfile=$PIDFILE $DAEMON $OPTS
+  echo
 }
 
 stop() {
-  pid=`$PIDOF $PROGNAME`
-  if [ &quot;$pid&quot; != &quot;&quot; ]; then
-    echo &quot;Stopping $PROGDIR$PROGNAME: $pid&quot;
-    kill $pid
-  else
-    echo &quot;$PROGDIR$PROGNAME not running&quot;
-  fi
+  echo -n $&quot;Stopping starling: &quot;
+
+  killproc -p $PIDFILE starling
+  echo
 }
 
 case &quot;$1&quot; in
-start)
-  start
-;;
-stop)
-  stop
-;;
-restart)
-  stop
-  sleep 3
-  start
-;;
-
+  start)
+    start
+  ;;
+  stop)
+    stop
+  ;;
+  restart)
+    stop
+    sleep 3
+    start
+  ;;
+  status)
+    status -p $PIDFILE starling
+  ;;
+  *)
+    echo $&quot;Usage: $0 {start|stop|restart|status}&quot;
+    exit 1
 esac</diff>
      <filename>etc/starling.redhat</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4b28ba077acf32fe4d1ac1930780d857e78d0f5c</id>
    </parent>
  </parents>
  <author>
    <name>Chris Gaffney</name>
    <email>cgaffney@crayoninterface.com</email>
  </author>
  <url>http://github.com/defunkt/starling/commit/eda69192cd0f0766adea1f9f4833601e0f3c7e83</url>
  <id>eda69192cd0f0766adea1f9f4833601e0f3c7e83</id>
  <committed-date>2008-10-01T14:24:37-07:00</committed-date>
  <authored-date>2008-10-01T14:24:37-07:00</authored-date>
  <message>Clean up and fix redhat init script.</message>
  <tree>1a42ef0915687fb9fee2f68773f89b8e394a688c</tree>
  <committer>
    <name>Chris Gaffney</name>
    <email>cgaffney@crayoninterface.com</email>
  </committer>
</commit>
