~ubuntu-branches/ubuntu/wily/glusterfs/wily

« back to all changes in this revision

Viewing changes to debian/glusterfs-server.init

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Matthäi, Louis Zuckerman, Patrick Matthäi
  • Date: 2011-05-01 14:41:05 UTC
  • mfrom: (1.3.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20110501144105-l5dut674ggp5f2yr
Tags: 3.1.4-1
[ Louis Zuckerman ]
* New upstream release.
  - Add patch 01-remove-argp-m64-option.diff to allow 32bit builds.
* Enabled pure-server or pure-client installation.
  - Moved glusterfsd binary to libglusterfs0.
  - Added dependency on libglusterfs0 to -server and -client packages.
  - Removed dependency on glusterfs-client from glusterfs-server.
  - Moved manpages for binaries into their respective packages
* Updated default configuration files to 3.1-series versions
  - Added glusterd.vol to glusterfs-server, required for Elastic Volume Mgr.
  - Removed unnecessary 3.0-series sample volume-files from glusterfs-server
  Closes: #615166
* Replaced init-script for glusterfs-server with new 3.1-series version.
  Closes: #615859

[ Patrick Matthäi ]
* Bump Standards-Version to 3.9.2 (no changes needed).
* Build with hardening-wrapper.
* Comment out all dependency_libs lines in .la files.
  Closes: #621169
* Add logrotate script to the libglusterfs0 package.
  Closes: #623234
* Remove rpath from all libs and binaries.
* Add patch 02-fix-spelling-errors.diff, which fixes multiple spelling errors
  in the source code.
* Add lintian overrides for the libglusterfs0 package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
# Short-Description: GlusterFS server
9
9
# Description:       GlusterFS is a cluster filesystem. This service
10
10
#                    provides the GlusterFS server functionality which
11
 
#                    is configured via a volume spec file usually
12
 
#                    located in the /etc/glusterfs directory.
 
11
#                    is configured using the 'gluster' command.
13
12
### END INIT INFO
14
13
 
15
14
# Author: Chris AtLee <chris@atlee.ca>
16
 
# Patched by: Matthias Albert <matthias@linux4experts.de>
17
 
# Upgraded by: Neil Wilson <neil@brightbox.co.uk>
18
 
# Slightly extended by: Christian Meder <chris@absolutegiganten.org>
 
15
# Patched by: Matthias Albert < matthias@linux4experts.de>
19
16
 
20
 
PATH=/usr/sbin:/usr/bin:/sbin:/bin
21
 
DESC="GlusterFS server"
22
 
NAME=glusterfsd
 
17
PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
18
NAME=glusterd
 
19
SCRIPTNAME=/etc/init.d/$NAME
23
20
DAEMON=/usr/sbin/$NAME
24
 
CONFIGFILE=/etc/glusterfs/glusterfsd.vol
25
 
LOGFILE=/var/log/glusterfs/glusterfsd.vol.log
26
21
PIDFILE=/var/run/$NAME.pid
27
 
DAEMON_ARGS="-p $PIDFILE -f $CONFIGFILE --log-file $LOGFILE"
28
 
SCRIPTNAME=/etc/init.d/glusterfs-server
29
 
 
30
 
# Exit if the package is not installed
31
 
[ -x "$DAEMON" ] || exit 0
32
 
 
33
 
# Read configuration variable file if it is present
34
 
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
 
22
GLUSTERD_OPTS=""
 
23
PID=`test -f $PIDFILE && cat $PIDFILE`
 
24
 
 
25
 
 
26
# Gracefully exit if the package has been removed.
 
27
test -x $DAEMON || exit 0
35
28
 
36
29
# Load the VERBOSE setting and other rcS variables
37
 
[ -f /etc/default/rcS ] && . /etc/default/rcS
 
30
. /lib/init/vars.sh
38
31
 
39
32
# Define LSB log_* functions.
40
 
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
41
33
. /lib/lsb/init-functions
42
34
 
43
35
 
44
 
#
45
 
# Function that starts the daemon/service
46
 
#
47
36
do_start()
48
37
{
49
 
        # Return
50
 
        #   0 if daemon has been started
51
 
        #   1 if daemon was already running
52
 
        #   2 if daemon could not be started
53
 
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
54
 
                || return 1
55
 
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
56
 
                $DAEMON_ARGS \
57
 
                || return 2
 
38
    pidofproc -p $PIDFILE $DAEMON >/dev/null
 
39
    status=$?
 
40
    if [ $status -eq 0 ]; then
 
41
      log_success_msg "glusterd service is already running with pid $PID"
 
42
    else
 
43
      log_daemon_msg "Starting glusterd service" "glusterd"
 
44
      start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -p $PIDFILE $GLUSTERD_OPTS
 
45
      log_end_msg $?
 
46
      start_daemon -p $PIDFILE $DAEMON -f $CONFIGFILE
 
47
      return $?
 
48
    fi
58
49
}
59
50
 
60
 
#
61
 
# Function that stops the daemon/service
62
 
#
63
51
do_stop()
64
52
{
65
 
        # Return
66
 
        #   0 if daemon has been stopped
67
 
        #   1 if daemon was already stopped
68
 
        #   2 if daemon could not be stopped
69
 
        #   other if a failure occurred
70
 
        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
71
 
        RETVAL="$?"
72
 
        [ "$RETVAL" = 2 ] && return 2
73
 
        # Wait for children to finish too if this is a daemon that forks
74
 
        # and if the daemon is only ever run from this initscript.
75
 
        # If the above conditions are not satisfied then add some other code
76
 
        # that waits for the process to drop all resources that could be
77
 
        # needed by services started subsequently.  A last resort is to
78
 
        # sleep for some time.
79
 
        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --name $NAME
80
 
        [ "$?" = 2 ] && return 2
81
 
        # Many daemons don't delete their pidfiles when they exit.
82
 
        rm -f $PIDFILE
83
 
        return "$RETVAL"
 
53
    log_daemon_msg "Stopping glusterd service" "glusterd"
 
54
    start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
 
55
    log_end_msg $?
 
56
    rm -f $PIDFILE
 
57
    killproc -p $PIDFILE $DAEMON
 
58
    return $?
84
59
}
85
60
 
86
 
#
87
 
# Function that provides status information about the service
88
 
#
89
61
do_status()
90
62
{
91
 
        start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME --startas $DAEMON --test > /dev/null
92
 
        RETVAL="$?"
93
 
        if [ "$RETVAL" = 1 ]; then
94
 
            log_success_msg "$DESC is running."
95
 
            exit 0
96
 
        fi
97
 
        if [ "$RETVAL" = 0 ]; then
98
 
            log_failure_msg "$DESC is not running."
99
 
            exit 1
100
 
        else
101
 
            log_failure_msg "Couldn't determine status of $DESC."
102
 
            exit 3
103
 
        fi
 
63
     pidofproc -p $PIDFILE $DAEMON >/dev/null
 
64
     status=$?
 
65
     if [ $status -eq 0 ]; then
 
66
       log_success_msg "glusterd service is running with pid $PID"
 
67
     else
 
68
       log_failure_msg "glusterd service is not running."
 
69
     fi
 
70
     exit $status
104
71
}
105
72
 
106
73
case "$1" in
107
74
  start)
108
 
        [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
109
 
        do_start
110
 
        EXITCODE=$?
111
 
        case "$EXITCODE" in
112
 
                0|1) log_end_msg 0 ;;
113
 
                2)   log_end_msg 1 ;;
114
 
        esac
115
 
        exit $EXITCODE
116
 
        ;;
 
75
        do_start
 
76
        ;;
117
77
  stop)
118
 
        [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
119
 
        do_stop
120
 
        case "$?" in
121
 
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
122
 
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
123
 
        esac
124
 
        ;;
125
 
  #reload|force-reload)
126
 
        #
127
 
        # If do_reload() is not implemented then leave this commented out
128
 
        # and leave 'force-reload' as an alias for 'restart'.
129
 
        #
130
 
        #log_daemon_msg "Reloading $DESC" "$NAME"
131
 
        #do_reload
132
 
        #log_end_msg $?
133
 
        #;;
 
78
        do_stop
 
79
        ;;
 
80
  status)
 
81
        do_status;
 
82
        ;;
134
83
  restart|force-reload)
135
 
        #
136
 
        # If the "reload" option is implemented then remove the
137
 
        # 'force-reload' alias
138
 
        #
139
 
        log_daemon_msg "Restarting $DESC" "$NAME"
140
 
        do_stop
141
 
        case "$?" in
142
 
          0|1)
143
 
                do_start
144
 
                case "$?" in
145
 
                        0) log_end_msg 0 ;;
146
 
                        1) log_end_msg 1 ;; # Old process is still running
147
 
                        *) log_end_msg 1 ;; # Failed to start
148
 
                esac
149
 
                ;;
150
 
          *)
151
 
                # Failed to stop
152
 
                log_end_msg 1
153
 
                ;;
154
 
        esac
155
 
        ;;
156
 
  status)
157
 
        do_status
 
84
        do_stop
 
85
        sleep 2
 
86
        do_start
158
87
        ;;
159
88
  *)
160
 
        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
161
 
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
162
 
        exit 3
163
 
        ;;
 
89
        echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
 
90
        exit 3
 
91
        ;;
164
92
esac
165
 
 
166
 
: