#!/bin/sh # # glusterfsd This shell script takes care of starting and stopping glusterfsd. # # chkconfig: 2345 90 12 # description: Glusterfsd server. # probe: false # processname: glusterfsd # pidfile: /var/run/glusterfsd/glusterfsd.pid # config: /etc/glusterfs/glusterfs-server.vol # config: /etc/sysconfig/glusterfsd ### BEGIN INIT INFO # Provides: glusterfsd # Required-Start: $local_fs $network fuse # Required-Stop: $local_fs $network fuse # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: gluster server # Description: Glusterfsd server. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 if [ -f /etc/sysconfig/glusterfsd ]; then . /etc/sysconfig/glusterfsd fi # See how we were called. case "$1" in start) GLUSTERFSD_PID=`ps ax | grep "\[glusterfs\]" | awk '{ print $1 }'` if ! [ -z "${GLUSTERFSD_PID}" ]; then echo "glusterfsd: already running" RETVAL=1 exit $RETVAL fi echo -n "Starting glusterfsd: " daemon glusterfsd \ --spec-file=${GLUSTERFSD_CONFIG_FILE:-"/etc/glusterfs/glusterfs-server.vol"} \ --log-file=${GLUSTERFSD_LOGFILE:-"/var/log/glusterfs/glusterfsd.log"} \ --log-level=${GLUSTERFSD_LOGLEVEL:-"WARNING"} \ --pidfile=${GLUSTERFSD_PIDFILE:-"/var/run/glusterfsd/glusterfsd.pid"} \ ${GLUSTERFSD_OPTIONS:-""} RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/glusterfsd echo ;; stop) GLUSTERFSD_PID=`ps ax | grep "\[glusterfs\]" | awk '{ print $1 }'` if [ -z "${GLUSTERFSD_PID}" ]; then echo "glusterfsd: is not running" RETVAL=1 exit $RETVAL fi echo -n "Stopping glusterfsd: " kill -TERM `cat ${GLUSTERFSD_PIDFILE:-"/var/run/glusterfsd/glusterfsd.pid"}` RETVAL=$? [ $RETVAL -eq 0 ] && success || failure [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/glusterfsd \ ${GLUSTERFSD_PIDFILE:-"/var/run/glusterfsd/glusterfsd.pid"} echo ;; status) status [glusterfs] ${GLUSTERFSD_PIDFILE:-"/var/run/glusterfsd/glusterfsd.pid"} ;; restart|reload) $0 stop $0 start ;; condrestart) [ -f /var/lock/subsys/glusterfsd ] && $0 restart ;; *) echo "Usage: glusterfsd {start|stop|status|restart|condrestart|reload}" exit 1 esac exit 0