UNFS3(User-space NFSv3 Server)
起動スクリプト
#!/bin/bash
# -*- mode: shell-script; coding: UTF-8 -*-
#
# chkconfig: 235 99 10
# description: Start or stop the unfs3 server
#
### BEGIN INIT INFO
# Provides: unfsd
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Start or stop the unfs3 server
### END INIT INFO
description="unfs3 NFS server"
lockfile="/var/lock/subsys/unfsd"
pidfile="/var/run/unfsd.pid"
case "$1" in
'start')
echo "Starting" ${description}
/usr/sbin/unfsd -i ${pidfile}
RETVAL=$?
if [ "${RETVAL}" = "0" ]; then
touch ${lockfile} >/dev/null 2>&1
fi
;;
'stop')
echo "Shutting down" ${description}
if [ -s ${pidfile} ]; then
pid=`cat ${pidfile}`
kill -TERM ${pid} 2>/dev/null
sleep 2
if kill -0 ${pid} 2>/dev/null; then
kill -KILL ${pid}
fi
fi
rm -f ${lockfile} ${pidfile}
;;
'status')
if [ -s ${pidfile} ]; then
pid=`cat ${pidfile}`
if kill -0 ${pid} 2>/dev/null; then
echo "${description} (pid ${pid}) is running"
RETVAL=0
else
echo "${description} is stopped"
RETVAL=1
fi
else
echo "${description} is stopped"
RETVAL=1
fi
;;
'restart')
$0 stop && $0 start
RETVAL=$?
;;
'condrestart')
[ -f /var/lock/subsys/unfsd ] && $0 stop &&
$0 start
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=1
;;
esac
exit $RETVAL