summaryrefslogtreecommitdiff
path: root/package/nfs-utils/files/nfsd.init
blob: 9379d6a397ab5159f6051a9e011d057f9344e36d (plain)
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
#!/bin/sh
#PKG nfs-utils
#INIT 70

. /etc/rc.conf

case $1 in
autostop) ;;
autostart)
	test x"${portmap:-NO}" = x"NO" && exit 0
	test x"${nfs_server:-NO}" = x"NO" && exit 0
	exec sh $0 start
	;;
start)
	/bin/mkdir -p /var/lib/nfs/v4recovery
	/bin/touch /var/lib/nfs/rmtab
	/bin/touch /var/lib/nfs/etab
	/bin/touch /var/lib/nfs/xtab
	/bin/touch /var/lib/nfs/sm
	chown nfs:nfs /var/lib/nfs/sm
	/usr/sbin/exportfs -r
	/usr/sbin/mountd
	/usr/sbin/nfsd
	/usr/sbin/statd
	if [ ${nfs_server_version} -eq 4 ];then
		mkdir -p /var/lib/nfs/rpc_pipefs
		mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
		/usr/sbin/idmapd
		/usr/sbin/svcgssd
	fi
	;;
stop)
	pkill nfsd
	pkill mountd
	pkill statd
	if [ ${nfs_server_version} -eq 4 ];then
		pkill idmapd
		pkill svcgssd
	fi
	;;
restart)
	sh $0 stop
	sh $0 start
	;;
*)
	echo "Usage: $0 {start | stop | restart}"
	exit 1
	;;
esac
exit $?