]> git.pld-linux.org Git - packages/nfs-utils.git/blob - nfs.init
- fix in checking is netforking is up.
[packages/nfs-utils.git] / nfs.init
1 #!/bin/sh
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
13 # Source function library
14 . /etc/rc.d/init.d/functions
15
16 # Get network config
17 . /etc/sysconfig/network
18
19 # Get service config
20 [ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
21
22 # Check that networking is up.
23 if [ "${NETWORKING}" = "no" ]; then
24         echo "WARNING: Networking is down. Nfs service can't be runed."
25         exit 1
26 fi
27
28 # Sanity check
29 [ -f /etc/exports ] || exit 0
30
31
32 # See how we were called.
33 case "$1" in
34   start)
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
44         touch /var/lock/subsys/nfs
45         ;;
46   stop)
47         # Stop daemons.
48         show Shutting down rpc.mountd
49         killproc rpc.mountd
50         show Shutting down rpc.nfsd
51         killproc rpc.nfsd
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
This page took 0.041393 seconds and 4 git commands to generate.