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.
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>
20
PATH=/usr/sbin:/usr/bin:/sbin:/bin
21
DESC="GlusterFS server"
17
PATH=/sbin:/usr/sbin:/bin:/usr/bin
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
30
# Exit if the package is not installed
31
[ -x "$DAEMON" ] || exit 0
33
# Read configuration variable file if it is present
34
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
23
PID=`test -f $PIDFILE && cat $PIDFILE`
26
# Gracefully exit if the package has been removed.
27
test -x $DAEMON || exit 0
36
29
# Load the VERBOSE setting and other rcS variables
37
[ -f /etc/default/rcS ] && . /etc/default/rcS
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
45
# Function that starts the daemon/service
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 \
55
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
38
pidofproc -p $PIDFILE $DAEMON >/dev/null
40
if [ $status -eq 0 ]; then
41
log_success_msg "glusterd service is already running with pid $PID"
43
log_daemon_msg "Starting glusterd service" "glusterd"
44
start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -p $PIDFILE $GLUSTERD_OPTS
46
start_daemon -p $PIDFILE $DAEMON -f $CONFIGFILE
61
# Function that stops the daemon/service
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
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.
53
log_daemon_msg "Stopping glusterd service" "glusterd"
54
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
57
killproc -p $PIDFILE $DAEMON
87
# Function that provides status information about the service
91
start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME --startas $DAEMON --test > /dev/null
93
if [ "$RETVAL" = 1 ]; then
94
log_success_msg "$DESC is running."
97
if [ "$RETVAL" = 0 ]; then
98
log_failure_msg "$DESC is not running."
101
log_failure_msg "Couldn't determine status of $DESC."
63
pidofproc -p $PIDFILE $DAEMON >/dev/null
65
if [ $status -eq 0 ]; then
66
log_success_msg "glusterd service is running with pid $PID"
68
log_failure_msg "glusterd service is not running."
108
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
112
0|1) log_end_msg 0 ;;
118
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
121
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
122
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
125
#reload|force-reload)
127
# If do_reload() is not implemented then leave this commented out
128
# and leave 'force-reload' as an alias for 'restart'.
130
#log_daemon_msg "Reloading $DESC" "$NAME"
134
83
restart|force-reload)
136
# If the "reload" option is implemented then remove the
137
# 'force-reload' alias
139
log_daemon_msg "Restarting $DESC" "$NAME"
146
1) log_end_msg 1 ;; # Old process is still running
147
*) log_end_msg 1 ;; # Failed to start
160
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
161
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
89
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2