As recommended by CoolCold.

Also changed NAME to searchd to make "/etc/init.d/sphinxsearch status" work. 
The /proc/{pid}/cmdline is searchd not /usr/bin/search when checking the status.

-- 
-- 
Daniel Black, Engineer @ Open Query (http://openquery.com)
Remote expertise & maintenance for MySQL/MariaDB server environments.
diff --git a/sphinxsearch-2.0.4/debian/cron.d b/sphinxsearch-2.0.4/debian/cron.d
index d14f324..d545f84 100644
--- a/sphinxsearch-2.0.4/debian/cron.d
+++ b/sphinxsearch-2.0.4/debian/cron.d
@@ -1,9 +1,9 @@
 
 # Rebuild all indexes daily and notify searchd.
-@daily      root . /etc/default/sphinxsearch && if [ "$START" = "yes" ] && [ -x /usr/bin/indexer ]; then /usr/bin/indexer --quiet --rotate --all; fi
+@daily      sphinxsearch . /etc/default/sphinxsearch && if [ "$START" = "yes" ] && [ -x /usr/bin/indexer ]; then /usr/bin/indexer --quiet --rotate --all; fi
 
 # Example for rotating only specific indexes (usually these would be part of
 # a larger combined index).
 
-# */5 * * * * root [ -x /usr/bin/indexer ] && /usr/bin/indexer --quiet --rotate postdelta threaddelta
+# */5 * * * * sphinxsearch [ -x /usr/bin/indexer ] && /usr/bin/indexer --quiet --rotate postdelta threaddelta
 
diff --git a/sphinxsearch-2.0.4/debian/init.d b/sphinxsearch-2.0.4/debian/init.d
index e128333..b380b4d 100644
--- a/sphinxsearch-2.0.4/debian/init.d
+++ b/sphinxsearch-2.0.4/debian/init.d
@@ -20,7 +20,7 @@
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/bin/searchd
-NAME=sphinxsearch
+NAME=searchd
 DESC=sphinxsearch
 
 test -x $DAEMON || exit 0
@@ -78,7 +78,7 @@ running()
     [ ! -f "$PIDFILE" ] && return 1
     # Obtain the pid and check it against the binary name
     pid=`cat $PIDFILE`
-    running_pid $pid $DAEMON || return 1
+    running_pid "${pid}" "${NAME}" || return 1
     return 0
 }
 
@@ -98,7 +98,7 @@ do_force_stop() {
             fi
         fi
     fi
-    rm -f $PIDFILE
+    rm -f "${PIDFILE}"
     return 0
 }
 do_start() {
@@ -110,18 +110,18 @@ do_start() {
             exit 1
         fi
 
-        start-stop-daemon --start --pidfile $PIDFILE --chuid sphinxsearch --exec ${DAEMON}
+        start-stop-daemon --start --pidfile "$PIDFILE" --chuid sphinxsearch --exec "${DAEMON}"
 }
 do_stop() {
-        start-stop-daemon --stop --quiet --oknodo --user sphinxsearch --pidfile $PIDFILE \
-            --exec $DAEMON
+        start-stop-daemon --stop --quiet --oknodo --user sphinxsearch --pidfile "${PIDFILE}" \
+            --exec "${DAEMON}"
 }
 
 case "$1" in
   start)
         echo -n "Starting $DESC: "
         do_start
-        [ -n "$STARTDELAY" ] && sleep $STARTDELAY
+        [ -n "$STARTDELAY" ] && sleep "${STARTDELAY}"
 
         if running ; then
             echo "$NAME."
@@ -146,7 +146,7 @@ case "$1" in
   restart|reload|force-reload)
     echo -n "Restarting $DESC: "
         do_stop
-        [ -n "$DODTIME" ] && sleep $DODTIME
+        [ -n "$DODTIME" ] && sleep "${DODTIME}"
         do_start
         echo "$NAME."
         ;;

Reply via email to