RHEL init script: ability to overwrite options from sysconfig

Change-Id: I15df0aef73e097a9ccfb00e2d4cae81d3a5a82fc
BUG: 885739
Signed-off-by: Filip Pytloun <filip.pytloun@gooddata.com>
Reviewed-on: http://review.gluster.org/4290
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Filip Pytloun 2012-12-10 14:41:10 +01:00 committed by Anand Avati
parent fef94c2acf
commit 6d58cb0476
4 changed files with 28 additions and 2 deletions

View File

@ -12,4 +12,4 @@ EXTRA_DIST = specgen.scm MacOSX/Portfile glusterfs-mode.el glusterfs.vim \
migrate-unify-to-distribute.sh backend-xattr-sanitize.sh \
backend-cleanup.sh disk_usage_sync.sh quota-remove-xattr.sh \
quota-metadata-cleanup.sh glusterfs-logrotate clear_xattrs.sh \
group-virt.example
group-virt.example glusterd-sysconfig

View File

@ -0,0 +1,6 @@
## Set custom log file and log level (bellow are defaults)
# LOG_FILE='/var/log/glusterfs/glusterd.log'
# LOG_LEVEL='INFO'
## Set custom options for glusterd
# GLUSTERD_OPTIONS=''

View File

@ -10,10 +10,21 @@
BASE=glusterd
PIDFILE=/var/run/$BASE.pid
PID=`test -f $PIDFILE && cat $PIDFILE`
# Overwriteable from sysconfig
LOG_LEVEL=''
LOG_FILE=''
GLUSTERD_OPTIONS=''
[ -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_OPTS="--pid-file=$PIDFILE ${GLUSTERD_OPTIONS}"
GLUSTERD="$GLUSTERD_BIN $GLUSTERD_OPTS"
RETVAL=0

View File

@ -234,6 +234,11 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha
%{__install} -p -m 0644 extras/hook-scripts/*.sh \
%{buildroot}%{_sharedstatedir}/glusterd/hook-scripts/
# Install sysconfig file
%{__mkdir_p} %{buildroot}%{_sysconfdir}/sysconfig
%{__install} -p -m 0644 extras/glusterd-sysconfig \
%{buildroot}%{_sysconfdir}/sysconfig/glusterd
# Create directories and files that get created during runtime. This should
# not be needed for files marged as "ghost", but rpm-4.9 is broken in this
# respect :-(
@ -379,6 +384,7 @@ fi
%doc extras/clear_xattrs.sh
#%doc examples/ doc/glusterfs*.vol.sample
%config(noreplace) %{_sysconfdir}/glusterfs
%config(noreplace) %{_sysconfdir}/sysconfig/glusterd
%{_sysconfdir}/init.d/glusterd
%{_sbindir}/gluster
%{_sbindir}/glusterd
@ -429,6 +435,9 @@ fi
%{_libdir}/*.so
%changelog
* Tue Dec 11 2012 Filip Pytloun <filip.pytloun@gooddata.com>
- add sysconfig file
* Wed Sep 05 2012 Niels de Vos <ndevos@redhat.com>
- Don't use python-ctypes on SLES (from Jörg Petersen)