~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/openafs-fileserver

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
### BEGIN INIT INFO
3
 
# Provides:             openafs-fileserver
4
 
# Required-Start:       $remote_fs $network $time $named
5
 
# Required-Stop:        $remote_fs $network
6
 
# Default-Start:        2 3 4 5
7
 
# Default-Stop:         0 1 6
8
 
# Short-Description:    OpenAFS file and database server manager
9
 
# Description:          Starts, stops, or restarts the OpenAFS bosserver,
10
 
#                       which is the process that starts and manages the
11
 
#                       OpenAFS file server or database servers depending on
12
 
#                       its configuration.
13
 
### END INIT INFO
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
24
 
DAEMON=/usr/sbin/bosserver
25
 
DAEMON_ARGS=""
26
 
SCRIPTNAME=/etc/init.d/openafs-fileserver
27
 
 
28
 
# Exit if the package is not installed and we were not given the status option.
29
 
if [ ! -x "$DAEMON" ] && [ "status" != "$1" ] ; then
30
 
    exit 0
31
 
fi
32
 
 
33
 
# Read configuration if it is present.
34
 
[ -r /etc/default/openafs-fileserver ] && . /etc/default/openafs-fileserver
35
 
 
36
 
# Get the setting of VERBOSE and other rcS variables.
37
 
[ -f /etc/default/rcS ] && . /etc/default/rcS
38
 
 
39
 
# Define LSB log functions (requires lsb-base >= 3.0-6).
40
 
. /lib/lsb/init-functions
41
 
 
42
 
# Make sure we don't leave file descriptors open.
43
 
exec 3>/dev/null
44
 
exec </dev/null
45
 
 
46
 
# Return
47
 
#   0 if daemon has been started
48
 
#   1 if daemon was already running
49
 
#   2 if daemon could not be started
50
 
do_start()
51
 
{
52
 
    start-stop-daemon --start --quiet --startas $DAEMON --name $NAME --test \
53
 
        > /dev/null || return 1
54
 
    start-stop-daemon --start --quiet --startas $DAEMON --name $NAME \
55
 
        -- $DAEMON_ARGS || return 2
56
 
}
57
 
 
58
 
# Return
59
 
#   0 if daemon has been stopped
60
 
#   1 if daemon was already stopped
61
 
#   2 if daemon could not be stopped
62
 
#   other if a failure occurred
63
 
do_stop()
64
 
{
65
 
    start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --name $NAME
66
 
}
67
 
 
68
 
case "$1" in 
69
 
  start)
70
 
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
71
 
    do_start
72
 
    case "$?" in
73
 
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
74
 
      2)   [ "$VERBOSE" != no ] && log_end_msg 1 ;;
75
 
    esac
76
 
    ;;
77
 
 
78
 
  stop)
79
 
    [ "$VERBOSE" != no ] && log_action_msg "Stopping OpenAFS services"
80
 
    bos shutdown localhost -wait -localauth
81
 
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
82
 
    do_stop
83
 
    case "$?" in
84
 
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
85
 
      2)   [ "$VERBOSE" != no ] && log_end_msg 1 ;;
86
 
    esac
87
 
    ;;
88
 
 
89
 
  restart|force-reload)
90
 
    [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
91
 
    start-stop-daemon --start --quiet --startas $DAEMON --name $NAME --test \
92
 
        > /dev/null
93
 
    case "$?" in
94
 
      0)
95
 
        do_start
96
 
        case "$?" in
97
 
          0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
98
 
          *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
99
 
        esac
100
 
        ;;
101
 
      1)
102
 
        bos restart localhost -all -bosserver -localauth
103
 
        case "$?" in
104
 
          0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
105
 
          *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
106
 
        esac
107
 
        ;;
108
 
      *)
109
 
        log_end_msg 1
110
 
        ;;
111
 
    esac
112
 
    ;;
113
 
 
114
 
  status)
115
 
    start-stop-daemon --start --quiet --startas $DAEMON --name $NAME --test \
116
 
        > /dev/null
117
 
    case "$?" in
118
 
      0)
119
 
        echo "$NAME is not running"
120
 
        exit 3
121
 
        ;;
122
 
      1)
123
 
        echo "$NAME is running"
124
 
        exit 0
125
 
        ;;
126
 
      *)
127
 
        log_warning_msg "Cannot determine if $NAME is running"
128
 
        exit 4
129
 
        ;;
130
 
    esac
131
 
    ;;
132
 
 
133
 
  *)
134
 
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
135
 
    exit 3
136
 
    ;;
137
 
esac
138
 
 
139
 
exit 0