forked from allspace/eunfs3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unfsd.init
71 lines (67 loc) · 1.66 KB
/
unfsd.init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/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