~ubuntu-branches/ubuntu/oneiric/openafs/oneiric-201305130334

« back to all changes in this revision

Viewing changes to debian/openafs-fileserver.init

  • Committer: Bazaar Package Importer
  • Author(s): Russ Allbery
  • Date: 2008-09-22 19:07:02 UTC
  • mfrom: (12.1.14 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080922190702-59m13d7kn6gkw32d
Tags: 1.4.7.dfsg1-6
* Apply upstream patch to free /proc entries in the correct order.
  Thanks, Marc Dionne.  (Closes: #493914)
* Apply upstream deltas to support 2.6.27 kernels and to stop using
  COMMON_KERN_CFLAGS for all 2.6 kernels uniformly, which fixes
  problems on amd64 with newer kernels.  Thanks, Björn Torkelsson.
  (LP: #267504)
* Translation updates:
  - Swedish, thanks Martin Bagge.  (Closes: #493120)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# Required-Start:       $local_fs $remote_fs $network $time
5
5
# Required-Stop:        $local_fs $remote_fs $network
6
6
# Default-Start:        2 3 4 5
7
 
# Default-Stop:         S 0 1 6
 
7
# Default-Stop:         0 1 6
8
8
# Short-Description:    OpenAFS file and database server manager
9
9
# Description:          Starts, stops, or restarts the OpenAFS bosserver,
10
10
#                       which is the process that starts and manages the
11
11
#                       OpenAFS file server or database servers depending on
12
12
#                       its configuration.
13
13
### END INIT INFO
14
 
#
15
 
# skeleton      example file to build /etc/init.d/ scripts.
16
 
#               This file should be used to construct scripts for /etc/init.d.
17
 
#
18
 
#               Written by Miquel van Smoorenburg <miquels@cistron.nl>.
19
 
#               Modified for Debian GNU/Linux
20
 
#               by Ian Murdock <imurdock@gnu.ai.mit.edu>.
21
 
#
22
 
# Version:      @(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl
23
 
#
24
 
 
25
 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 
14
 
 
15
# Author: Sam Hartman <hartmans@mit.edu>
 
16
# Author: Russ Allbery <rra@debian.org>
 
17
#
 
18
# Based on the /etc/init.d/skeleton template as found in initscripts version
 
19
# 2.86.ds1-15.
 
20
 
 
21
PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
22
DESC="OpenAFS BOS server"
 
23
NAME=bosserver
26
24
DAEMON=/usr/sbin/bosserver
27
 
NAME=bosserver
28
 
DESC="AFS Server"
29
 
 
30
 
 
 
25
DAEMON_ARGS=""
 
26
SCRIPTNAME=/etc/init.d/openafs-fileserver
 
27
 
 
28
# Exit if the package is not installed.
 
29
[ -x "$DAEMON" ] || exit 0
 
30
 
 
31
# Read configuration if it is present.
 
32
[ -r /etc/default/openafs-fileserver ] && . /etc/default/openafs-fileserver
 
33
 
 
34
# Get the setting of VERBOSE and other rcS variables.
 
35
[ -f /etc/default/rcS ] && . /etc/default/rcS
 
36
 
 
37
# Define LSB log functions (requires lsb-base >= 3.0-6).
 
38
. /lib/lsb/init-functions
 
39
 
 
40
# Make sure we don't leave file descriptors open.
31
41
exec 3>/dev/null
32
42
exec </dev/null
33
43
 
34
 
test -f $DAEMON || exit 0
35
 
 
36
 
 
37
 
 
38
 
case "$1" in
 
44
# Return
 
45
#   0 if daemon has been started
 
46
#   1 if daemon was already running
 
47
#   2 if daemon could not be started
 
48
do_start()
 
49
{
 
50
    start-stop-daemon --start --quiet --startas $DAEMON --name $NAME --test \
 
51
        > /dev/null || return 1
 
52
    start-stop-daemon --start --quiet --startas $DAEMON --name $NAME \
 
53
        -- $DAEMON_ARGS || return 2
 
54
}
 
55
 
 
56
# Return
 
57
#   0 if daemon has been stopped
 
58
#   1 if daemon was already stopped
 
59
#   2 if daemon could not be stopped
 
60
#   other if a failure occurred
 
61
do_stop()
 
62
{
 
63
    start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --name $NAME
 
64
}
 
65
 
 
66
case "$1" in 
39
67
  start)
40
 
        echo -n "Starting $DESC: "
41
 
        start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
42
 
                --exec $DAEMON
43
 
        echo "$NAME."
44
 
        ;;
 
68
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
 
69
    do_start
 
70
    case "$?" in
 
71
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
 
72
      2)   [ "$VERBOSE" != no ] && log_end_msg 1 ;;
 
73
    esac
 
74
    ;;
 
75
 
45
76
  stop)
46
 
        echo -n "Stopping $DESC: "
 
77
    [ "$VERBOSE" != no ] && log_action_msg "Stopping OpenAFS services"
47
78
    bos shutdown localhost -wait -localauth
48
 
        start-stop-daemon --stop --quiet  \
49
 
                --user root --name bosserver
50
 
        echo "$NAME."
51
 
        ;;
52
 
  #reload)
53
 
        #
54
 
        #       If the daemon can reload its config files on the fly
55
 
        #       for example by sending it SIGHUP, do it here.
56
 
        #
57
 
        #       If the daemon responds to changes in its config file
58
 
        #       directly anyway, make this a do-nothing entry.
59
 
        #
60
 
        # echo "Reloading $DESC configuration files."
61
 
        # start-stop-daemon --stop --signal 1 --quiet --pidfile \
62
 
        #       /var/run/$NAME.pid --exec $DAEMON
63
 
  #;;
 
79
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
 
80
    do_stop
 
81
    case "$?" in
 
82
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
 
83
      2)   [ "$VERBOSE" != no ] && log_end_msg 1 ;;
 
84
    esac
 
85
    ;;
 
86
 
64
87
  restart|force-reload)
65
 
        #
66
 
        #       If the "reload" option is implemented, move the "force-reload"
67
 
        #       option to the "reload" entry above. If not, "force-reload" is
68
 
        #       just the same as "restart".
69
 
        #
70
 
        echo -n "Restarting $DESC: "
71
 
        if pidof $DAEMON > /dev/null ; then
72
 
            bos restart localhost -localauth -bos
73
 
        else
74
 
            start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
75
 
                --exec $DAEMON
76
 
        fi
77
 
        sleep 1
78
 
        echo "$NAME."
79
 
        ;;
 
88
    [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
 
89
    start-stop-daemon --start --quiet --startas $DAEMON --name $NAME --test \
 
90
        > /dev/null
 
91
    case "$?" in
 
92
      0)
 
93
        do_start
 
94
        case "$?" in
 
95
          0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
 
96
          *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
 
97
        esac
 
98
        ;;
 
99
      1)
 
100
        bos restart localhost -all -bosserver -localauth
 
101
        case "$?" in
 
102
          0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
 
103
          *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
 
104
        esac
 
105
        ;;
 
106
      *)
 
107
        log_end_msg 1
 
108
        ;;
 
109
    esac
 
110
    ;;
 
111
 
80
112
  *)
81
 
        N=/etc/init.d/$NAME
82
 
        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
83
 
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
84
 
        exit 1
85
 
        ;;
 
113
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
 
114
    exit 3
 
115
    ;;
86
116
esac
87
117
 
88
118
exit 0