bozo: report bosserver -rxbind address
[openafs.git] / src / packaging / RedHat / openafs-server.init
1 #!/bin/bash
2 #
3 # openafs-server        Start/Stop the OpenAFS Server
4 #
5 # chkconfig: 2345 49 51
6 # description: OpenAFS is a distributed filesystem.
7 #
8 # $Revision$
9
10 [ -f /etc/init.d/functions ] && . /etc/init.d/functions
11 [ -f /etc/sysconfig/openafs ] && . /etc/sysconfig/openafs
12
13
14 start() {
15         echo -n $"Starting openafs-server: "
16         if [ -e /var/lock/subsys/openafs-server ] ; then
17                 echo -n $"cannot start openafs-server: already running"
18                 failure $"cannot start openafs-server: already running"
19                 echo
20                 return 1
21         fi
22         /usr/afs/bin/bosserver $BOSSERVER_ARGS
23         RETVAL=$?
24         echo
25         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/openafs-server
26         return $RETVAL
27 }
28
29 stop() {
30         echo -n $"Stopping openafs-server: "
31         if [ ! -e /var/lock/subsys/openafs-server ] ; then
32                 echo -n $"cannot stop openafs-server: not running"
33                 failure $"cannot stop openafs-server: not running"
34                 echo
35                 return 1
36         fi
37         if [ "x$BOSSERVER_HOST" = "x" ] ; then
38                 if [ -f /usr/afs/local/bosserver.rxbind ] ; then
39                         BOSSERVER_HOST=`cat /usr/afs/local/bosserver.rxbind`
40                 else
41                         BOSSERVER_HOST="localhost"
42                 fi
43         fi
44         /usr/bin/bos shutdown $BOSSERVER_HOST -wait -localauth
45         RETVAL=$?
46         if [ $RETVAL -ne 0 ] ; then
47                 echo -n $"failed to shutdown OpenAFS"
48                 failure $"failed to shutdown OpenAFS"
49                 echo
50                 return $RETVAL
51         fi
52         killproc bosserver
53         RETVAL=$?
54         echo
55         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/openafs-server
56         [ $RETVAL -eq 0 ] && rm -f /usr/afs/local/bosserver.rxbind
57         return $RETVAL
58 }
59
60 rhstatus() {
61         status bosserver
62 }
63
64 restart() {
65         stop || exit
66         start
67 }
68
69 case "$1" in
70   start)
71         start
72         ;;
73   stop)
74         stop
75         ;;
76   restart)
77         restart
78         ;;
79   status)
80         rhstatus
81         ;;
82   condrestart)
83         if [ "x$AFS_USE_BINARY_RESTART" = "xyes" ]; then
84             # this is what never shows up as
85             if [ `grep -c 'checkbintime 16 0 0 0 0' /usr/afs/local/BosConfig` = 1 ]; then
86                 [ -f /var/lock/subsys/openafs-server ] && restart || :
87             else
88                 echo $"deferring for newbinary restart"
89             fi
90         else
91             [ -f /var/lock/subsys/openafs-server ] && restart || :
92         fi
93         ;;
94   *)
95         echo $"Usage: $0 {start|stop|status|restart|condrestart}"
96         exit 1
97 esac