diff options
author | Harshavardhana <harsha@zresearch.com> | 2009-02-27 10:23:08 -0800 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-02-28 00:06:22 +0530 |
commit | b2db5d966f210be72250fb87e513d187d3de7fdd (patch) | |
tree | 9600f267b789eb209ca26db37d9eaf82d748891e | |
parent | 3aff44fab8ba7a109bd691b8675dbfd9842237a3 (diff) |
Added /etc/init.d/glusterfsd for rpmbuilds
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r-- | extras/init.d/Makefile.am | 7 | ||||
-rwxr-xr-x | extras/init.d/glusterfsd | 89 | ||||
-rw-r--r-- | glusterfs.spec.in | 4 |
3 files changed, 24 insertions, 76 deletions
diff --git a/extras/init.d/Makefile.am b/extras/init.d/Makefile.am index 608b5bb2d..73e9745cd 100644 --- a/extras/init.d/Makefile.am +++ b/extras/init.d/Makefile.am @@ -3,7 +3,10 @@ EXTRA_DIST = glusterfsd glusterfs-server glusterfs-server.plist CLEANFILES = -install-data-am: +initdir = $(sysconfdir)/init.d +init_DATA = glusterfsd + +install-data-local: if GF_DARWIN_HOST_OS - cp glusterfs-server.plist /Library/LaunchDaemons/com.zresearch.glusterfs.plist + cp glusterfs-server.plist /Library/LaunchDaemons/com.zresearch.glusterfs.plist endif diff --git a/extras/init.d/glusterfsd b/extras/init.d/glusterfsd index 866a0010e..992513157 100755 --- a/extras/init.d/glusterfsd +++ b/extras/init.d/glusterfsd @@ -5,88 +5,29 @@ # # Get function from functions library -# . /etc/rc.d/init.d/functions +. /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 -} +GSERVER="/usr/sbin/$BASE -f /etc/glusterfs/glusterfsd.vol" +RETVAL=0 # 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 + echo -n $"Starting $BASE:" + daemon $GSERVER + RETVAL=$? + [ $RETVAL -ne 0 ] && exit $RETVAL } # 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 + echo $"Stopping $BASE:" + killproc $BASE } + ### service arguments ### case $1 in start) @@ -96,14 +37,14 @@ case $1 in stop ;; status) - status + status $BASE ;; - restart|reload|condrestart) - stop - start + restart) + $0 stop + $0 start ;; *) - echo $.Usage: $0 {start|stop|restart|reload|status}. + echo $"Usage: $0 {start|stop|status|restart}." exit 1 esac diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 1740bbc36..24f9e99bb 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -154,6 +154,7 @@ This package provides the development libraries. %_prefix/sbin/glusterfsd %_mandir/man8/glusterfs.8.gz %_infodir/user-guide.info.gz +%_sysconfdir/init.d/glusterfsd %exclude %_infodir/dir %if %with_client @@ -185,6 +186,9 @@ ldconfig %changelog +* Fri Feb 27 2009 Harshavardhana <harsha@gluster.com> - 2.0 +- Added /etc/init.d/glusterfsd + * Fri Dec 12 2008 Harshavardhana <harsha@gluster.com> - 1.4 - Added new options with --with-apxspath --with-apachepath new configure options. |