rpm: Update CellServDB
[openafs.git] / src / packaging / RedHat / openafs-client.init
1 #!/bin/bash
2 #
3 # openafs-client        Start/Stop the OpenAFS Client
4 #
5 # chkconfig: 2345 50 50
6 # description: OpenAFS is a distributed filesystem.
7 # Should-Start: dkms
8 #
9 # $Revision$
10
11 [ -f /etc/init.d/functions ] && . /etc/init.d/functions
12 [ -f /etc/sysconfig/openafs ] && . /etc/sysconfig/openafs
13
14
15 start() {
16         echo -n $"Updating CellServDB: "
17         cat /usr/vice/etc/CellServDB.local /usr/vice/etc/CellServDB.dist > \
18                /usr/vice/etc/CellServDB
19         chmod 644 /usr/vice/etc/CellServDB
20         echo
21         echo -n $"Starting openafs-client: "
22         if [ -e /var/lock/subsys/openafs-client ] ; then
23                 echo -n $"cannot start openafs-client: already running"
24                 failure $"cannot start openafs-client: already running"
25                 echo
26                 return 1
27         fi
28         modprobe openafs
29         RETVAL=$?
30         if [ $RETVAL -ne 0 ] ; then
31                 echo -n $"failed to load openafs kernel module."
32                 failure $"failed to load openafs kernel module."
33                 echo
34                 return $RETVAL
35         fi
36         /usr/vice/etc/afsd $AFSD_ARGS
37         RETVAL=$?
38         echo
39         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/openafs-client
40         [ $RETVAL -eq 0 ] && [ "$AFS_POST_INIT" ] && $AFS_POST_INIT
41         return $RETVAL
42 }
43
44 stop() {
45         echo -n $"Stopping openafs-client: "
46         if [ ! -e /var/lock/subsys/openafs-client ] ; then
47                 echo -n $"cannot stop openafs-client: not running"
48                 failure $"cannot stop openafs-client: not running"
49                 echo
50                 return 1
51         fi
52         umount /afs
53         RETVAL=$?
54         echo
55         if [ $RETVAL -eq 0 ] ; then
56                 rm -f /var/lock/subsys/openafs-client
57                 rmmod openafs
58         fi
59         return $RETVAL
60 }
61
62 rhstatus() {
63         status afsd
64         return $?
65 }
66
67 restart() {
68         stop || exit
69         start
70 }
71
72 case "$1" in
73   start)
74         start
75         ;;
76   stop)
77         stop
78         ;;
79   restart)
80         restart
81         ;;
82   status)
83         rhstatus
84         exit $?
85         ;;
86   condrestart)
87         [ -f /var/lock/subsys/openafs-client ] && restart || :
88         ;;
89   *)
90         echo $"Usage: $0 {start|stop|status|restart|condrestart}"
91         exit 1
92 esac