]>
Commit | Line | Data |
---|---|---|
083dbab7 | 1 | #!/bin/bash |
2 | # | |
3 | # nfs This shell script takes care of starting and stopping | |
4 | # the NFS services. Later we might add NIS too. | |
5 | # | |
6 | # chkconfig: 345 60 20 | |
7 | # description: NFS is a popular protocol for file sharing across TCP/IP \ | |
8 | # networks. This service provides NFS server functionality, \ | |
9 | # which is configured via the /etc/exports file. | |
10 | # probe: true | |
11 | ||
12 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin | |
13 | ||
14 | # Source function library. | |
15 | . /etc/rc.d/init.d/functions | |
16 | ||
17 | # Source networking configuration. | |
18 | . /etc/sysconfig/network | |
19 | ||
20 | # Check that networking is up. | |
21 | [ ${NETWORKING} = "no" ] && exit 0 | |
22 | ||
23 | # Try to define nicelevel ... | |
24 | NICE="nice -n 5" | |
25 | ||
26 | [ -f /usr/sbin/rpc.nfsd ] || exit 0 | |
27 | [ -f /usr/sbin/rpc.mountd ] || exit 0 | |
28 | [ -f /etc/exports ] || exit 0 | |
29 | ||
30 | # See how we were called. | |
31 | case "$1" in | |
32 | start) | |
33 | # Start daemons. | |
34 | echo -n "Starting NFS services: " | |
35 | $NICE rpc.mountd | |
36 | $NICE rpc.nfsd | |
37 | echo done | |
38 | touch /var/lock/subsys/nfs | |
39 | ;; | |
40 | stop) | |
41 | # Stop daemons. | |
42 | echo -n "Shutting down NFS services: " | |
43 | killall -TERM rpc.mountd | |
44 | killall -TERM rpc.nfsd | |
45 | echo done | |
46 | rm -f /var/lock/subsys/nfs | |
47 | ;; | |
48 | status) | |
49 | status rpc.mountd | |
50 | status rpc.nfsd | |
51 | ;; | |
52 | restart) | |
53 | $0 stop | |
54 | $0 start | |
55 | ;; | |
56 | *) | |
57 | echo "Usage: $0 {start|stop|status|restart}" | |
58 | exit 1 | |
59 | esac | |
60 | ||
61 | exit 0 | |
62 |