diff --git a/debian/mogilefsd.default b/debian/mogilefsd.default new file mode 100644 index 00000000..831d1135 --- /dev/null +++ b/debian/mogilefsd.default @@ -0,0 +1,9 @@ +# Defaults for mogilefsd - sourced by /etc/init.d/mogilefsd + +# Start mogilefsd on boot? +START=yes + +# Startup options +DAEMON_OPTS="" + +MOGILEFSD_RUNASUSER=mogile diff --git a/debian/mogilefsd.init b/debian/mogilefsd.init index b17a70e0..a3edeb54 100755 --- a/debian/mogilefsd.init +++ b/debian/mogilefsd.init @@ -11,12 +11,11 @@ # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/bin/mogilefsd +DAEMON=/usr/local/bin/mogilefsd NAME=mogilefsd DESC=mogilefsd DEFAULTS=/etc/default/$NAME -PIDDIR=/var/run/$NAME -PIDFILE=$PIDDIR/$NAME.pid +PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed @@ -48,13 +47,6 @@ set -e # do_start() { - - if ! test -d ${PIDDIR} - then - mkdir ${PIDDIR} - chown ${MOGILEFSD_RUNASUSER} ${PIDDIR} - fi - if [ -e $PIDFILE ] then @@ -69,7 +61,7 @@ do_start() fi - start-stop-daemon --start --quiet --exec $DAEMON -b --name $NAME --chuid $MOGILEFSD_RUNASUSER -- $MOGILEFSD_EXTRA_OPTS + start-stop-daemon --start --quiet --exec $DAEMON --pidfile $PIDFILE -b -m --name $NAME --chuid $MOGILEFSD_RUNASUSER } # @@ -81,6 +73,16 @@ do_stop() rm -f $PIDFILE } +do_status() +{ + if [ -f ${PIDFILE} ]; then + echo $NAME: running. + else + echo $NAME: not running. + exit 5 + fi +} + case "$1" in start) echo -n "Starting $DESC: " @@ -105,11 +107,14 @@ case "$1" in do_start echo "$NAME." ;; + status) + do_status + ;; *) - #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2 exit 3 ;; esac -: +: \ No newline at end of file diff --git a/debian/mogstored.default b/debian/mogstored.default new file mode 100644 index 00000000..f5af2569 --- /dev/null +++ b/debian/mogstored.default @@ -0,0 +1,9 @@ +# Defaults for mogstored - sourced by /etc/init.d/mogstored + +# Start mogstored on boot? +START=yes + +# Startup options +DAEMON_OPTS="" + +MOGSTORED_RUNASUSER=mogile diff --git a/debian/mogstored.init b/debian/mogstored.init index 06c5ec76..2800f24a 100755 --- a/debian/mogstored.init +++ b/debian/mogstored.init @@ -11,12 +11,11 @@ # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/bin/mogstored +DAEMON=/usr/local/bin/mogstored NAME=mogstored DESC=mogstored DEFAULTS=/etc/default/$NAME -PIDDIR=/var/run/$NAME -PIDFILE=$PIDDIR/$NAME.pid +PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed @@ -48,12 +47,6 @@ set -e # do_start() { - if ! test -d ${PIDDIR} - then - mkdir ${PIDDIR} - chown ${MOGSTORED_RUNASUSER} ${PIDDIR} - fi - if [ -e $PIDFILE ] then @@ -80,6 +73,16 @@ do_stop() rm -f $PIDFILE } +do_status() +{ + if [ -f ${PIDFILE} ]; then + echo $NAME: running. + else + echo $NAME: not running. + exit 5 + fi +} + case "$1" in start) echo -n "Starting $DESC: " @@ -91,7 +94,9 @@ case "$1" in do_stop echo "$NAME." ;; - + status) + do_status + ;; restart|force-reload) # # If the "reload" option is implemented, move the "force-reload" @@ -105,10 +110,10 @@ case "$1" in echo "$NAME." ;; *) - #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2 exit 3 ;; esac -: +: \ No newline at end of file