#!/bin/bash
#
# Init file for the MooseFS master service
# chkconfig: - 92 84
# description: MooseFS master
# processname: mfsmaster
# Source function library.
# Source networking configuration.
. /etc/init.d/functions
. /etc/sysconfig/network
# Source initialization configuration.
prefix="/usr/local/mfs"
pidfile="/var/run/mfsmaster.pid"
# Check that networking is up.
[ "${NETWORKING}" == "no" ] && exit 0
[ -x "$prefix/sbin/mfsmaster" ] || exit 1
[ -r "$prefix/etc/mfsmaster.cfg" ] || exit 1
[ -r "$prefix/etc/mfsexports.cfg" ] || exit 1
RETVAL=0
prog="mfsmaster"
datadir="/opt/mfs/var/mfs"
mfsbin="/usr/local/mfs/sbin/mfsmaster"
mfsrestore="/usr/local/mfs/sbin/mfsmeta"
start () {
echo -n $"Starting $prog: "
daemon --pidfile=${pidfile} $mfsbin start #>/dev/null 2>&1
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog &&pidof "$mfsbin" >$pidfile
return $RETVAL
}
stop () {
echo -n $"Stopping $prog: "
$mfsbin -s >/dev/null 2>&1 || killproc $prog #>/dev/null 2>&1
[ $RETVAL -eq 0 ] && rm -f $pid_file && rm -f /var/lock/subsys/$prog
restart () {
stop
start
reload () {
echo -n $"reload $prog: "
$mfsbin reload >/dev/null 2>&1 #|| killproc $prog #>/dev/null 2>&1
/var/lock/subsys/$prog
restore () {
echo -n $"restore $prog: "
$mfsrestore -a -d $datadir
case "$1" in
start)
;;
stop)
restart)
restart
reload)
reload
restore)
restore
condrestart)
[ -e /var/lock/subsys/$prog ] && restart
status)
status $prog
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=1
esac
exit $RETVAL