diff options
Diffstat (limited to 'extras/init.d')
| -rw-r--r-- | extras/init.d/Makefile.am | 17 | ||||
| -rwxr-xr-x | extras/init.d/glusterd-Debian.in (renamed from extras/init.d/glusterfsd-Debian.in) | 31 | ||||
| -rwxr-xr-x | extras/init.d/glusterd-Redhat.in | 142 | ||||
| -rwxr-xr-x | extras/init.d/glusterd-SuSE.in (renamed from extras/init.d/glusterfsd-SuSE.in) | 31 | ||||
| -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-Redhat.in | 54 | ||||
| -rwxr-xr-x | extras/init.d/rhel5-load-fuse.modules | 7 |
7 files changed, 189 insertions, 99 deletions
diff --git a/extras/init.d/Makefile.am b/extras/init.d/Makefile.am index c09016178..38898fddd 100644 --- a/extras/init.d/Makefile.am +++ b/extras/init.d/Makefile.am @@ -1,19 +1,22 @@ -EXTRA_DIST = glusterfsd-Debian glusterfsd-Redhat glusterfsd-SuSE glusterfs-server.plist +EXTRA_DIST = glusterd-Debian glusterd-Redhat glusterd-SuSE glusterd.plist rhel5-load-fuse.modules CLEANFILES = -initdir = @initdir@ -launchddir = @launchddir@ +INIT_DIR = @initdir@ +SYSTEMD_DIR = @systemddir@ +LAUNCHD_DIR = @launchddir@ $(GF_DISTRIBUTION): - $(mkdir_p) $(DESTDIR)$(initdir) - $(INSTALL_PROGRAM) glusterfsd-$(GF_DISTRIBUTION) $(DESTDIR)$(initdir)/glusterfsd + @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 - $(mkdir_p) $(DESTDIR)$(launchddir) - $(INSTALL_PROGRAM) glusterfs-server.plist $(DESTDIR)$(launchddir)/com.gluster.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/glusterfsd-Debian.in b/extras/init.d/glusterd-Debian.in index a0c83d535..918f8592c 100755 --- a/extras/init.d/glusterfsd-Debian.in +++ 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=@prefix@/sbin/$NAME PIDFILE=/var/run/$NAME.pid -CONFIGFILE=/etc/glusterfs/glusterfsd.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/glusterfsd-SuSE.in b/extras/init.d/glusterd-SuSE.in index 43552bb49..6259bab00 100755 --- a/extras/init.d/glusterfsd-SuSE.in +++ b/extras/init.d/glusterd-SuSE.in @@ -1,31 +1,30 @@ #!/bin/bash # ### BEGIN INIT INFO -# Provides: glusterfsd -# Required-Start: $local_fs $network -# Required-Stop: +# Provides: glusterd +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network # Default-Start: 3 5 # Default-Stop: -# Short-Description: GlusterFS server daemon -# Description: All necessary services for GlusterFS clients +# 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=glusterfsd -GLUSTERFSD_BIN=@prefix@/sbin/$BASE -CONFIGFILE=/etc/glusterfs/glusterfsd.vol -GLUSTERFSD_OPTS="-f $CONFIGFILE" -GSERVER="$GLUSTERFSD_BIN $GLUSTERFSD_OPTS" +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 $GSERVER + startproc $GLUSTERD return $? } @@ -33,7 +32,7 @@ start() stop() { echo $"Stopping $BASE:" - killproc $BASE + killproc $BASE return $? } @@ -55,20 +54,24 @@ case $1 in rc_status -v ;; status) - echo -n " glusterfsd" + 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|restart}." + echo $"Usage: $0 {start|stop|status|reload|restart}." exit 1 esac diff --git a/extras/init.d/glusterfs-server.plist.in b/extras/init.d/glusterd.plist.in index 624dfe22d..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.gluster.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-Redhat.in b/extras/init.d/glusterfsd-Redhat.in deleted file mode 100755 index 2f5009ef7..000000000 --- a/extras/init.d/glusterfsd-Redhat.in +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# chkconfig: 35 90 12 -# description: Glusterfsd server -# - -# Get function from functions library -. /etc/rc.d/init.d/functions - -BASE=glusterfsd -GLUSTERFSD_BIN=@exec_prefix@/sbin/$BASE -CONFIGFILE=/etc/glusterfs/glusterfsd.vol -GLUSTERFSD_OPTS="-f $CONFIGFILE" -GSERVER="$GLUSTERFSD_BIN $GLUSTERFSD_OPTS" -RETVAL=0 - -# Start the service $BASE -start() -{ - echo $"Starting $BASE:" - daemon $GSERVER - RETVAL=$? - [ $RETVAL -ne 0 ] && exit $RETVAL -} - -# Stop the service $BASE -stop() -{ - echo $"Stopping $BASE:" - killproc $BASE -} - - -### service arguments ### -case $1 in - start) - start - ;; - stop) - stop - ;; - status) - status $BASE - ;; - restart) - $0 stop - $0 start - ;; - *) - echo $"Usage: $0 {start|stop|status|restart}." - 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 |
