]>
Commit | Line | Data |
---|---|---|
bf44c74c | 1 | #!/bin/sh |
083dbab7 | 2 | # |
3 | # nfs This shell script takes care of starting and stopping | |
4 | # the NFS services. Later we might add NIS too. | |
5 | # | |
0e3733a2 | 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 | |
083dbab7 | 11 | |
0e3733a2 | 12 | |
13 | # Source function library | |
083dbab7 | 14 | . /etc/rc.d/init.d/functions |
15 | ||
0e3733a2 | 16 | # Get network config |
083dbab7 | 17 | . /etc/sysconfig/network |
18 | ||
0e3733a2 | 19 | # Get service config |
20 | [ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs | |
21 | ||
083dbab7 | 22 | # Check that networking is up. |
7bf93ef0 | 23 | if [ "${NETWORKING}" = "no" ]; then |
24 | echo "WARNING: Networking is down. Nfs service can't be runed." | |
25 | exit 1 | |
26 | fi | |
083dbab7 | 27 | |
0e3733a2 | 28 | # Sanity check |
083dbab7 | 29 | [ -f /etc/exports ] || exit 0 |
30 | ||
0e3733a2 | 31 | |
083dbab7 | 32 | # See how we were called. |
33 | case "$1" in | |
34 | start) | |
0e3733a2 | 35 | # Check if the service is already running? |
36 | if [ ! -f /var/lock/subsys/nfs ]; then | |
37 | show Starting rpc.mountd | |
38 | daemon rpc.mountd | |
39 | show Starting rpc.nfsd | |
40 | daemon rpc.nfsd | |
41 | else | |
42 | echo "nfs already is running" | |
43 | fi | |
083dbab7 | 44 | touch /var/lock/subsys/nfs |
45 | ;; | |
46 | stop) | |
47 | # Stop daemons. | |
bf44c74c | 48 | show Shutting down rpc.mountd |
49 | killproc rpc.mountd | |
50 | show Shutting down rpc.nfsd | |
51 | killproc rpc.nfsd | |
083dbab7 | 52 | rm -f /var/lock/subsys/nfs |
53 | ;; | |
54 | status) | |
55 | status rpc.mountd | |
56 | status rpc.nfsd | |
57 | ;; | |
58 | restart) | |
59 | $0 stop | |
60 | $0 start | |
61 | ;; | |
62 | *) | |
63 | echo "Usage: $0 {start|stop|status|restart}" | |
64 | exit 1 | |
65 | esac | |
66 | ||
67 | exit 0 | |
68 |