diff options
Diffstat (limited to 'extras/init.d')
| -rw-r--r-- | extras/init.d/Makefile.am | 31 | ||||
| -rwxr-xr-x | extras/init.d/glusterd-Debian.in (renamed from extras/init.d/glusterfsd-Debian) | 33 | ||||
| -rw-r--r-- | extras/init.d/glusterd-FreeBSD.in | 24 | ||||
| -rwxr-xr-x | extras/init.d/glusterd-Redhat.in | 143 | ||||
| -rwxr-xr-x | extras/init.d/glusterd-SuSE.in (renamed from extras/init.d/glusterfsd-SuSE) | 28 | ||||
| -rw-r--r-- | extras/init.d/glusterd.plist.in (renamed from extras/init.d/glusterfs-server.plist.in) | 6 | ||||
| -rw-r--r-- | extras/init.d/glustereventsd-Debian.in | 91 | ||||
| -rw-r--r-- | extras/init.d/glustereventsd-FreeBSD.in | 19 | ||||
| -rw-r--r-- | extras/init.d/glustereventsd-Redhat.in | 129 | ||||
| -rwxr-xr-x | extras/init.d/glusterfsd-Redhat | 51 |
10 files changed, 460 insertions, 95 deletions
diff --git a/extras/init.d/Makefile.am b/extras/init.d/Makefile.am index da9bb00786d..8d8cc69571a 100644 --- a/extras/init.d/Makefile.am +++ b/extras/init.d/Makefile.am @@ -1,17 +1,32 @@ -EXTRA_DIST = glusterfsd-Debian glusterfsd-Redhat glusterfsd-SuSE glusterfs-server.plist +EXTRA_DIST = glusterd-Debian glusterd-FreeBSD glusterd-Redhat \ + glusterd-SuSE glusterd.plist glustereventsd-FreeBSD \ + glustereventsd-Redhat glustereventsd-Debian -CLEANFILES = +CLEANFILES = -initdir = /etc/init.d +INIT_DIR = @initdir@ +SYSTEMD_DIR = @systemddir@ +LAUNCHD_DIR = @launchddir@ -$(GF_DISTRIBUTION): - $(mkdir_p) $(DESTDIR)$(initdir) - $(INSTALL_PROGRAM) $(srcdir)/glusterfsd-$(GF_DISTRIBUTION) $(DESTDIR)$(initdir)/glusterfsd +$(GF_DISTRIBUTION): +if WITH_SERVER + @if [ ! -d $(SYSTEMD_DIR) ]; then \ + $(mkdir_p) $(DESTDIR)$(INIT_DIR); \ + $(INSTALL_PROGRAM) glusterd-$(GF_DISTRIBUTION) $(DESTDIR)$(INIT_DIR)/glusterd; \ + fi +endif +if BUILD_EVENTS + @if [ ! -d $(SYSTEMD_DIR) ]; then \ + $(mkdir_p) $(DESTDIR)$(INIT_DIR); \ + $(INSTALL_PROGRAM) glustereventsd-$(GF_DISTRIBUTION) $(DESTDIR)$(INIT_DIR)/glustereventsd; \ + fi +endif install-exec-local: $(GF_DISTRIBUTION) -install-data-local: +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)/org.gluster.glusterd.plist endif diff --git a/extras/init.d/glusterfsd-Debian b/extras/init.d/glusterd-Debian.in index dcd3e0c50f1..918f8592c6e 100755 --- a/extras/init.d/glusterfsd-Debian +++ 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/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-FreeBSD.in b/extras/init.d/glusterd-FreeBSD.in new file mode 100644 index 00000000000..21c3da72624 --- /dev/null +++ b/extras/init.d/glusterd-FreeBSD.in @@ -0,0 +1,24 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: glusterd + +. /etc/rc.subr + +name="glusterd" +rcvar=`set_rcvar` +command=@prefix@/sbin/${name} +pidfile="/var/run/${name}.pid" +glusterd_flags="-p /var/run/${name}.pid" +start_precmd="glusterd_prestart" + +glusterd_prestart() +{ + mkdir -p @GLUSTERD_WORKDIR@ /var/log/glusterfs + return 0 +} + +load_rc_config $name +run_rc_command "$1" diff --git a/extras/init.d/glusterd-Redhat.in b/extras/init.d/glusterd-Redhat.in new file mode 100755 index 00000000000..94801fe31a5 --- /dev/null +++ b/extras/init.d/glusterd-Redhat.in @@ -0,0 +1,143 @@ +#!/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: 2 3 4 5 +# Default-Stop: 0 1 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=$? + echo + [ $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 b/extras/init.d/glusterd-SuSE.in index ede27b2b3c8..6259bab00b6 100755 --- a/extras/init.d/glusterfsd-SuSE +++ b/extras/init.d/glusterd-SuSE.in @@ -1,28 +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 -GSERVER="/usr/sbin/$BASE -f /etc/glusterfs/glusterfsd.vol" +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 $? } @@ -30,7 +32,7 @@ start() stop() { echo $"Stopping $BASE:" - killproc $BASE + killproc $BASE return $? } @@ -52,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 4d2287c5759..3ee9f60c5c5 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>org.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/glustereventsd-Debian.in b/extras/init.d/glustereventsd-Debian.in new file mode 100644 index 00000000000..6eebdb2b8d8 --- /dev/null +++ b/extras/init.d/glustereventsd-Debian.in @@ -0,0 +1,91 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: glustereventsd +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Gluster Events Server +# Description: Gluster Events Server +### END INIT INFO + +# Author: Chris AtLee <chris@atlee.ca> +# Patched by: Matthias Albert < matthias@linux4experts.de> + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +NAME=glustereventsd +SCRIPTNAME=/etc/init.d/$NAME +DAEMON=@prefix@/sbin/$NAME +PIDFILE=/var/run/$NAME.pid +GLUSTEREVENTSD_OPTS="" +PID=`test -f $PIDFILE && cat $PIDFILE` + + +# Gracefully exit if the package has been removed. +test -x $DAEMON || exit 0 + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +. /lib/lsb/init-functions + + +do_start() +{ + pidofproc -p $PIDFILE $DAEMON >/dev/null + status=$? + if [ $status -eq 0 ]; then + log_success_msg "glustereventsd service is already running with pid $PID" + else + log_daemon_msg "Starting glustereventsd service" "glustereventsd" + start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -p $PIDFILE $GLUSTEREVENTSD_OPTS + log_end_msg $? + start_daemon -p $PIDFILE $DAEMON -f $CONFIGFILE + return $? + fi +} + +do_stop() +{ + log_daemon_msg "Stopping glustereventsd service" "glustereventsd" + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE + log_end_msg $? + rm -f $PIDFILE + killproc -p $PIDFILE $DAEMON + return $? +} + +do_status() +{ + pidofproc -p $PIDFILE $DAEMON >/dev/null + status=$? + if [ $status -eq 0 ]; then + log_success_msg "glustereventsd service is running with pid $PID" + else + log_failure_msg "glustereventsd service is not running." + fi + exit $status +} + +case "$1" in + start) + do_start + ;; + stop) + do_stop + ;; + status) + do_status; + ;; + restart|force-reload) + do_stop + sleep 2 + do_start + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + diff --git a/extras/init.d/glustereventsd-FreeBSD.in b/extras/init.d/glustereventsd-FreeBSD.in new file mode 100644 index 00000000000..2e8303ec6c6 --- /dev/null +++ b/extras/init.d/glustereventsd-FreeBSD.in @@ -0,0 +1,19 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: glustereventsd + +. /etc/rc.subr + +name="glustereventsd" +rcvar=`set_rcvar` +command=@prefix@/sbin/${name} +command_interpreter=/usr/local/bin/python +pidfile="/var/run/${name}.pid" +glustereventsd_flags="-p /var/run/${name}.pid" +start_cmd="/usr/sbin/daemon $command ${glustereventsd_flags}" + +load_rc_config $name +run_rc_command "$1" diff --git a/extras/init.d/glustereventsd-Redhat.in b/extras/init.d/glustereventsd-Redhat.in new file mode 100644 index 00000000000..d23ce4c244f --- /dev/null +++ b/extras/init.d/glustereventsd-Redhat.in @@ -0,0 +1,129 @@ +#!/bin/bash +# +# glustereventsd Startup script for the glusterfs Events server +# +# chkconfig: - 20 80 +# description: Gluster Events Server + +### BEGIN INIT INFO +# Provides: glustereventsd +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Should-Start: +# Should-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: glusterfs Events server +# Description: GlusterFS Events Server +### END INIT INFO +# + +# Source function library. +. /etc/rc.d/init.d/functions + +BASE=glustereventsd + +# Fedora File System Layout dictates /run +[ -e /run ] && RUNDIR="/run" +PIDFILE="${RUNDIR:-/var/run}/${BASE}.pid" + +PID=`test -f $PIDFILE && cat $PIDFILE` + +GLUSTEREVENTSD_BIN=@prefix@/sbin/$BASE +GLUSTEREVENTSD_OPTS="--pid-file=$PIDFILE" +GLUSTEREVENTSD="$GLUSTEREVENTSD_BIN $GLUSTEREVENTSD_OPTS" +RETVAL=0 + +LOCKFILE=/var/lock/subsys/${BASE} + +# Start the service $BASE +start() +{ + if pidofproc -p $PIDFILE $GLUSTEREVENTSD_BIN &> /dev/null; then + echo "glustereventsd service is already running with pid $PID" + return 0 + else + echo -n $"Starting $BASE:" + daemon $GLUSTEREVENTSD & + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $LOCKFILE + return $RETVAL + fi +} + +# Stop the service $BASE +stop() +{ + echo -n $"Stopping $BASE:" + if pidofproc -p $PIDFILE $GLUSTEREVENTSD_BIN &> /dev/null; then + killproc -p $PIDFILE $BASE + else + killproc $BASE + fi + RETVAL=$? + echo + [ $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-Redhat b/extras/init.d/glusterfsd-Redhat deleted file mode 100755 index 2577e9e7647..00000000000 --- a/extras/init.d/glusterfsd-Redhat +++ /dev/null @@ -1,51 +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="/usr/sbin/$BASE -f /etc/glusterfs/glusterfsd.vol" -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 |
