X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=unfs3%2Funfsd.init;fp=unfs3%2Funfsd.init;h=0f66d2aa9dc0ae4bdc661b1555200f11941b8e99;hb=1ddb92b899989e26e26a4491251d4bc61be22918;hp=0000000000000000000000000000000000000000;hpb=af6b53b5ca2a8493dd5caca8a3a134a46b03272e;p=unfs3 diff --git a/unfs3/unfsd.init b/unfs3/unfsd.init new file mode 100755 index 0000000..0f66d2a --- /dev/null +++ b/unfs3/unfsd.init @@ -0,0 +1,71 @@ +#!/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') + /etc/init.d/unfsd stop && /etc/init.d/unfsd start + RETVAL=$? + ;; + 'condrestart') + [ -f /var/lock/subsys/unfsd ] && /etc/init.d/unfsd stop && /etc/init.d/unfsd start + RETVAL=$? + ;; + *) + echo "Usage: $0 {start|stop|restart|condrestart|status}" + RETVAL=1 + ;; +esac +exit $RETVAL +