diff options
Diffstat (limited to 'extras/init.d')
| -rw-r--r-- | extras/init.d/Makefile.am | 19 | ||||
| -rwxr-xr-x | extras/init.d/glusterd-Debian.in (renamed from extras/init.d/glusterfs-server) | 33 | ||||
| -rwxr-xr-x | extras/init.d/glusterd-Redhat.in | 142 | ||||
| -rwxr-xr-x | extras/init.d/glusterd-SuSE.in | 78 | ||||
| -rw-r--r-- | extras/init.d/glusterd.plist.in (renamed from extras/init.d/glusterfs-server.plist.in) | 6 | ||||
| -rwxr-xr-x | extras/init.d/glusterfsd | 110 | ||||
| -rwxr-xr-x | extras/init.d/rhel5-load-fuse.modules | 7 |
7 files changed, 257 insertions, 138 deletions
diff --git a/extras/init.d/Makefile.am b/extras/init.d/Makefile.am index 608b5bb2d..38898fddd 100644 --- a/extras/init.d/Makefile.am +++ b/extras/init.d/Makefile.am @@ -1,9 +1,22 @@ -EXTRA_DIST = glusterfsd glusterfs-server glusterfs-server.plist +EXTRA_DIST = glusterd-Debian glusterd-Redhat glusterd-SuSE glusterd.plist rhel5-load-fuse.modules CLEANFILES = -install-data-am: +INIT_DIR = @initdir@ +SYSTEMD_DIR = @systemddir@ +LAUNCHD_DIR = @launchddir@ + +$(GF_DISTRIBUTION): + @if [ ! -d $(SYSTEMD_DIR) ]; then \ + $(mkdir_p) $(DESTDIR)$(INIT_DIR); \ + $(INSTALL_PROGRAM) glusterd-$(GF_DISTRIBUTION) $(DESTDIR)$(INIT_DIR)/glusterd; \ + fi + +install-exec-local: $(GF_DISTRIBUTION) + +install-data-local: if GF_DARWIN_HOST_OS - cp glusterfs-server.plist /Library/LaunchDaemons/com.zresearch.glusterfs.plist + $(mkdir_p) $(DESTDIR)$(LAUNCHD_DIR) + $(INSTALL_PROGRAM) glusterd.plist $(DESTDIR)$(LAUNCHD_DIR)/com.gluster.glusterd.plist endif diff --git a/extras/init.d/glusterfs-server b/extras/init.d/glusterd-Debian.in index 975283982..918f8592c 100755 --- a/extras/init.d/glusterfs-server +++ b/extras/init.d/glusterd-Debian.in @@ -1,24 +1,23 @@ #!/bin/sh ### BEGIN INIT INFO -# Provides: glusterfsd +# Provides: glusterd # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: gluster server -# Description: This file starts / stops the gluster server +# Short-Description: Gluster File System service for volume management +# Description: Gluster File System service for volume management ### END INIT INFO # Author: Chris AtLee <chris@atlee.ca> # Patched by: Matthias Albert < matthias@linux4experts.de> PATH=/sbin:/usr/sbin:/bin:/usr/bin -NAME=glusterfsd +NAME=glusterd SCRIPTNAME=/etc/init.d/$NAME -DAEMON=/usr/sbin/$NAME +DAEMON=@prefix@/sbin/$NAME PIDFILE=/var/run/$NAME.pid -CONFIGFILE=/etc/glusterfs/server.vol -GLUSTERFS_OPTS="-f $CONFIGFILE" +GLUSTERD_OPTS="" PID=`test -f $PIDFILE && cat $PIDFILE` @@ -31,24 +30,16 @@ test -x $DAEMON || exit 0 # Define LSB log_* functions. . /lib/lsb/init-functions -check_config() -{ - if [ ! -f "$CONFIGFILE" ]; then - echo "Config file $CONFIGFILE is missing...exiting!" - exit 0 - fi -} do_start() { - check_config; pidofproc -p $PIDFILE $DAEMON >/dev/null status=$? if [ $status -eq 0 ]; then - log_success_msg "glusterfs server is already running with pid $PID" + log_success_msg "glusterd service is already running with pid $PID" else - log_daemon_msg "Starting glusterfs server" "glusterfsd" - start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -p $PIDFILE $GLUSTERFS_OPTS + log_daemon_msg "Starting glusterd service" "glusterd" + start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -p $PIDFILE $GLUSTERD_OPTS log_end_msg $? start_daemon -p $PIDFILE $DAEMON -f $CONFIGFILE return $? @@ -57,7 +48,7 @@ do_start() do_stop() { - log_daemon_msg "Stopping glusterfs server" "glusterfsd" + log_daemon_msg "Stopping glusterd service" "glusterd" start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE log_end_msg $? rm -f $PIDFILE @@ -70,9 +61,9 @@ do_status() pidofproc -p $PIDFILE $DAEMON >/dev/null status=$? if [ $status -eq 0 ]; then - log_success_msg "glusterfs server is running with pid $PID" + log_success_msg "glusterd service is running with pid $PID" else - log_failure_msg "glusterfs server is not running." + log_failure_msg "glusterd service is not running." fi exit $status } diff --git a/extras/init.d/glusterd-Redhat.in b/extras/init.d/glusterd-Redhat.in new file mode 100755 index 000000000..e320708ae --- /dev/null +++ b/extras/init.d/glusterd-Redhat.in @@ -0,0 +1,142 @@ +#!/bin/bash +# +# glusterd Startup script for the glusterfs server +# +# chkconfig: - 20 80 +# description: Clustered file-system server + +### BEGIN INIT INFO +# Provides: glusterd +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Should-Start: +# Should-Stop: +# Default-Start: +# Default-Stop: 0 1 2 3 4 5 6 +# Short-Description: glusterfs server +# Description: Clustered file-system server +### END INIT INFO +# + +# Source function library. +. /etc/rc.d/init.d/functions + +BASE=glusterd + +# Fedora File System Layout dictates /run +[ -e /run ] && RUNDIR="/run" +PIDFILE="${RUNDIR:-/var/run}/${BASE}.pid" + +PID=`test -f $PIDFILE && cat $PIDFILE` + +# Overwriteable from sysconfig +LOG_LEVEL='' +LOG_FILE='' +GLUSTERD_OPTIONS='' +GLUSTERD_NOFILE='65536' + +[ -f /etc/sysconfig/${BASE} ] && . /etc/sysconfig/${BASE} + +[ ! -z $LOG_LEVEL ] && GLUSTERD_OPTIONS="${GLUSTERD_OPTIONS} --log-level ${LOG_LEVEL}" +[ ! -z $LOG_FILE ] && GLUSTERD_OPTIONS="${GLUSTERD_OPTIONS} --log-file ${LOG_FILE}" + +GLUSTERFSD=glusterfsd +GLUSTERFS=glusterfs +GLUSTERD_BIN=@prefix@/sbin/$BASE +GLUSTERD_OPTS="--pid-file=$PIDFILE ${GLUSTERD_OPTIONS}" +GLUSTERD="$GLUSTERD_BIN $GLUSTERD_OPTS" +RETVAL=0 + +LOCKFILE=/var/lock/subsys/${BASE} + +# Start the service $BASE +start() +{ + if pidofproc -p $PIDFILE $GLUSTERD_BIN &> /dev/null; then + echo "glusterd service is already running with pid $PID" + return 0 + else + ulimit -n $GLUSTERD_NOFILE + echo -n $"Starting $BASE:" + daemon $GLUSTERD + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $LOCKFILE + return $RETVAL + fi +} + +# Stop the service $BASE +stop() +{ + echo -n $"Stopping $BASE:" + if pidofproc -p $PIDFILE $GLUSTERD_BIN &> /dev/null; then + killproc -p $PIDFILE $BASE + else + killproc $BASE + fi + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f $LOCKFILE + return $RETVAL +} + +restart() +{ + stop + start +} + +reload() +{ + restart +} + +force_reload() +{ + restart +} + +rh_status() +{ + status $BASE +} + +rh_status_q() +{ + rh_status &>/dev/null +} + + +### service arguments ### +case $1 in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 1 +esac + +exit $? diff --git a/extras/init.d/glusterd-SuSE.in b/extras/init.d/glusterd-SuSE.in new file mode 100755 index 000000000..6259bab00 --- /dev/null +++ b/extras/init.d/glusterd-SuSE.in @@ -0,0 +1,78 @@ +#!/bin/bash +# +### BEGIN INIT INFO +# Provides: glusterd +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Default-Start: 3 5 +# Default-Stop: +# Short-Description: Gluster File System service for volume management +# Description: Gluster File System service for volume management +### END INIT INFO + +# Get function from functions library + +. /etc/rc.status + +BASE=glusterd +GLUSTERD_BIN=@prefix@/sbin/$BASE +GLUSTERD_OPTS="" +GLUSTERD="$GLUSTERD_BIN $GLUSTERD_OPTS" +RETVAL=0 + +# Start the service $BASE +start() +{ + echo -n $"Starting $BASE:" + startproc $GLUSTERD + return $? +} + +# Stop the service $BASE +stop() +{ + echo $"Stopping $BASE:" + killproc $BASE + return $? +} + + +### service arguments ### +case $1 in + start) + start || { + rc_status -v + rc_exit + } + rc_status -v + ;; + stop) + stop || { + rc_status -v + rc_exit + } + rc_status -v + ;; + status) + echo -n " glusterd" + if ! checkproc $BASE ;then + echo " not running" + rc_failed 3 + fi + rc_status -v + ;; + reload) + rc_failed 3 + rc_status -v + ;; + restart) + $0 stop + $0 start + rc_status + ;; + *) + echo $"Usage: $0 {start|stop|status|reload|restart}." + exit 1 +esac + +exit 0 diff --git a/extras/init.d/glusterfs-server.plist.in b/extras/init.d/glusterd.plist.in index 4d2287c57..7385fa486 100644 --- a/extras/init.d/glusterfs-server.plist.in +++ b/extras/init.d/glusterd.plist.in @@ -3,13 +3,11 @@ <plist version="1.0"> <dict> <key>Label</key> - <string>com.zresearch.glusterfs</string> + <string>com.gluster.glusterd</string> <key>ProgramArguments</key> <array> - <string>@prefix@/sbin/glusterfsd</string> + <string>@prefix@/sbin/glusterd</string> <string>-N</string> - <string>-f</string> - <string>@prefix@/etc/glusterfs/server.vol</string> </array> </dict> </plist> diff --git a/extras/init.d/glusterfsd b/extras/init.d/glusterfsd deleted file mode 100755 index 866a0010e..000000000 --- a/extras/init.d/glusterfsd +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -# -# chkconfig: 35 90 12 -# description: Glusterfsd server -# - -# Get function from functions library -# . /etc/rc.d/init.d/functions - -BASE=glusterfsd -GSERVER="/sbin/$BASE -f /etc/glusterfs/glusterfs-server.vol" - -# A function to stop gluster -killgluster() -{ - killlevel="-9" - # Find pid. - pid= - if [ -f /var/run/$BASE.pid ]; then - local line p - read line < /var/run/$BASE.pid - for p in $line ; do - [ -z "${p//[0-9]/}" -a -d "/proc/$p" ] && pid="$pid -$p" - done - fi - if [ -z "$pid" ]; then - pid=`pidof -o $$ -o $PPID -o %PPID -x $1 || \ - pidof -o $$ -o $PPID -o %PPID -x $BASE` - fi - # Kill it. - kill $killlevel $pid - if [ "$?" = 0 ] - then - echo "Gluster process $pid has been killed" - initlog -n "Kill gluster" -e 1 - else - echo "Failed: Gluster process $pid has not been killed" - initlog -n "Kill gluster" -e 2 - fi - - # Remove pid and lock file if any. - if [ -f /var/run/$BASE.pid ] - then - rm -f /var/run/$BASE.pid && initlog -n "Remove $BASE.pid:" -e -1 - else echo "$BASE.pid not found" && initlog -n "Remove -$BASE.pid:" -e 2 - fi - - if [ -f /var/lock/subsys/$BASE ] - then - rm -f /var/lock/subsys/$BASE && initlog -n "Remove $BASE lock -file:" -e 1 - else echo "$BASE lock file not found" && initlog -n "Remove -$BASE lock file:" -e 2 - fi -} - -# Start the service $BASE -start() -{ - initlog -c "echo -n Starting $BASE:" - $GSERVER - if [ $? = 0 ] - then - touch /var/lock/subsys/$BASE - initlog -n "Starting $BASE" -e 1 - echo " [OK]" - else - echo "$BASE start failed." - initlog -n "$BASE start" -e 2 - fi -} - -# Stop the service $BASE -stop() -{ - echo "Stopping $BASE:" - killgluster -} -status() -{ - if test "`lsof |grep -c /sbin/$BASE`" = "0" - then echo "$BASE is stopped." - else echo "$BASE is running..." - fi -} - -### service arguments ### -case $1 in - start) - start - ;; - stop) - stop - ;; - status) - status - ;; - restart|reload|condrestart) - stop - start - ;; - *) - echo $.Usage: $0 {start|stop|restart|reload|status}. - exit 1 -esac - -exit 0 diff --git a/extras/init.d/rhel5-load-fuse.modules b/extras/init.d/rhel5-load-fuse.modules new file mode 100755 index 000000000..ee194db99 --- /dev/null +++ b/extras/init.d/rhel5-load-fuse.modules @@ -0,0 +1,7 @@ +#!/bin/sh +# +# fusermount-glusterfs requires the /dev/fuse character device. The fuse module +# provides this and is loaded on demand in newer Linux distributions. +# + +[ -c /dev/fuse ] || /sbin/modprobe fuse |
