manila-image-elements/elements/manila-ganesha-nfs/install.d/nfs-ganesha

72 lines
1.3 KiB
Bash

#!/bin/bash
# nfs-ganesha init script for ubuntu
# source function library
. /lib/lsb/init-functions
PATHPROG=/usr/bin/ganesha.nfsd
LOGFILE=/var/log/ganesha.log
CONFFILE=/etc/ganesha/ganesha.conf
prog=ganesha.nfsd
PID_FILE=${PID_FILE:=/var/run/${prog}.pid}
LOCK_FILE=${LOCK_FILE:=/var/lock/subsys/${prog}}
[ -f /etc/sysconfig/ganesha ] && . /etc/sysconfig/ganesha
OPTIONS="-L $LOGFILE -f $CONFFILE -N NIV_EVENT"
RETVAL=0
start() {
log_daemon_msg "Starting $prog"
start-stop-daemon \
--start --oknodo --pidfile "$PID_FILE" --exec $PATHPROG -- $OPTIONS
status=$?
[ $status = 0 ]
log_end_msg $status
echo
}
stop() {
log_daemon_msg "Stopping $prog"
start-stop-daemon \
--stop --quiet --retry 5 --oknodo --pidfile $PID_FILE
status=$?
log_end_msg $status
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
status)
if pidof ganesha.nfsd >/dev/null
then
echo "ganesha.nfsd running"
exit 0
else
echo "ganesha.nfsd not running"
exit 3
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|try-restart|status}"
RETVAL=1
esac
exit $RETVAL