From 487b5c24a82280fcc8c524901864a2ecec459655 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Sun, 9 Sep 2012 10:20:21 +0000 Subject: [PATCH] Updates and fixes due to setup script changes: - don't stop harvester when not installed - fix startup when missing bdii package - move BDII startup setup to bdii section (everything BDII-related in bdii action) - add SITE* variables into glite-lb configuration example - update cron scripts and the purge and notif-keeper scripts - move purger script from glite-lb-client-progs to glite-lb-server --- org.glite.lb.client/Makefile | 1 - .../project/debian.glite-lb-client-progs.dirs | 1 - .../project/debian.glite-lb-client-progs.install | 1 - org.glite.lb.client/project/glite-lb-client.spec | 1 - org.glite.lb.server/Makefile | 17 +++++++++++++---- org.glite.lb.server/config/glite-lb | 5 +++++ org.glite.lb.server/config/glite-lb-proxy-purge.cron | 2 +- org.glite.lb.server/config/glite-lb-server-purge.cron | 2 +- org.glite.lb.server/config/setup | 7 +++++-- .../export.sh => org.glite.lb.server/src/export.sh.in | 15 +++++++++++---- .../src/{notif-keeper.sh => notif-keeper.sh.in} | 5 ++++- 11 files changed, 40 insertions(+), 17 deletions(-) rename org.glite.lb.client/src/export.sh => org.glite.lb.server/src/export.sh.in (88%) rename org.glite.lb.server/src/{notif-keeper.sh => notif-keeper.sh.in} (98%) diff --git a/org.glite.lb.client/Makefile b/org.glite.lb.client/Makefile index 4b07dc2..6da718f 100644 --- a/org.glite.lb.client/Makefile +++ b/org.glite.lb.client/Makefile @@ -397,7 +397,6 @@ endif done ${INSTALL} -m 644 ${top_srcdir}/examples/Makefile "${DESTDIR}${PREFIX}${prefix}/share/doc/${package}-${version}/examples/" ${INSTALL} -m 644 ${top_srcdir}/examples/README.examples "${DESTDIR}${PREFIX}${prefix}/share/doc/${package}-${version}/examples/" - ${INSTALL} -m 755 ${top_srcdir}/src/export.sh "${DESTDIR}${PREFIX}${prefix}/sbin/glite-lb-export.sh" ${INSTALL} -m 755 ${top_srcdir}/examples/notify.pl ${DESTDIR}${PREFIX}${prefix}/${libdir}/glite-lb/examples/glite-lb-notify.pl ${INSTALL} -m 755 ${top_srcdir}/examples/sandbox_transfers.sh ${DESTDIR}${PREFIX}${prefix}/${libdir}/glite-lb/examples/glite-lb-sandbox_transfers.sh ${INSTALL} -m 644 ${MAN_GZ} ${DESTDIR}${PREFIX}${prefix}/share/man/man1 diff --git a/org.glite.lb.client/project/debian.glite-lb-client-progs.dirs b/org.glite.lb.client/project/debian.glite-lb-client-progs.dirs index c752420..7ba17ff 100644 --- a/org.glite.lb.client/project/debian.glite-lb-client-progs.dirs +++ b/org.glite.lb.client/project/debian.glite-lb-client-progs.dirs @@ -1,3 +1,2 @@ usr/bin usr/lib/glite-lb/examples -usr/sbin diff --git a/org.glite.lb.client/project/debian.glite-lb-client-progs.install b/org.glite.lb.client/project/debian.glite-lb-client-progs.install index 2250368..c5cde5a 100644 --- a/org.glite.lb.client/project/debian.glite-lb-client-progs.install +++ b/org.glite.lb.client/project/debian.glite-lb-client-progs.install @@ -1,3 +1,2 @@ usr/bin/* usr/lib/glite-lb/examples/* -usr/sbin/* diff --git a/org.glite.lb.client/project/glite-lb-client.spec b/org.glite.lb.client/project/glite-lb-client.spec index d910697..f49842f 100644 --- a/org.glite.lb.client/project/glite-lb-client.spec +++ b/org.glite.lb.client/project/glite-lb-client.spec @@ -123,7 +123,6 @@ rm -rf $RPM_BUILD_ROOT /usr/bin/glite-lb-notify /usr/bin/glite-lb-register_sandbox /usr/%{_lib}/glite-lb/examples/* -/usr/sbin/glite-lb-export.sh %changelog diff --git a/org.glite.lb.server/Makefile b/org.glite.lb.server/Makefile index 48c15eb..e0a7d9f 100644 --- a/org.glite.lb.server/Makefile +++ b/org.glite.lb.server/Makefile @@ -30,7 +30,7 @@ SOURCES=\ config/glite-lb* config/my.cnf config/*.conf config/startup config/setup \ doc/*.1 doc/*.8 \ interface/*.h \ - src/*.c src/*.cpp src/*.h src/*.c.T src/*.l src/*.y src/*.sh src/ws_typemap.dat \ + src/*.c src/*.cpp src/*.h src/*.c.T src/*.l src/*.y src/*.sh src/*.sh.in src/ws_typemap.dat \ project/.post* project/.pre* \ test/*.cpp test/*.cpp.T test/*.sh test/oneJob.qry test/*.c \ LICENSE Makefile @@ -308,6 +308,7 @@ EXAMPLES= TESTS=test_coverage test_xml test_query_events test_soap_conv test_query_parse SCRIPTS=startup setup glite-lb-server-purge.cron glite-lb-proxy-purge.cron glite-lb-notif-keeper.cron glite-lb +SCRIPTS2=export.sh notif-keeper.sh SCRIPTS_SRC=$(addprefix ${top_srcdir}/config/,${SCRIPTS}) glite-lb-bkserverd: ${NSMAP} ${BKSERVER_OBJS} @@ -319,7 +320,7 @@ glite-lb-bkindex: ${INDEX_OBJS} glite-lb-mon-db: ${MONDB_OBJS} ${LINKXX} -o $@ ${MONDB_OBJS} ${MONDB_LIBS} -compile: generate ${SCRIPTS} glite-lb-bkserverd glite-lb-bkindex glite-lb-mon-db ${STATIC_LIB_BK} ${LCAS_PLUGIN_LIB} ${MAN_GZ} +compile: generate ${SCRIPTS} ${SCRIPTS2} glite-lb-bkserverd glite-lb-bkindex glite-lb-mon-db ${STATIC_LIB_BK} ${LCAS_PLUGIN_LIB} ${MAN_GZ} generate: store.c index.c @@ -330,6 +331,13 @@ ${SCRIPTS}: ${SCRIPTS_SRC} fi; \ sed -e 's:@glite_prefix@:${sysroot}${prefix}:g' -e 's:@glite_etc@:${sysconfdir}:g' -e "s:@glite_var@:$$glite_var:g" -e 's:@defaultdir@:${sysdefaultdir}:g' ${top_srcdir}/config/$@ > $@ +%.sh: %.sh.in + glite_var="${localstatedir}/glite"; \ + if echo "${localstatedir}" | grep 'glite'>/dev/null; then \ + glite_var="${localstatedir}"; \ + fi; \ + sed -e 's:@glite_prefix@:${sysroot}${prefix}:g' -e 's:@glite_etc@:${sysconfdir}:g' -e "s:@glite_var@:$$glite_var:g" -e 's:@defaultdir@:${sysdefaultdir}:g' $< > $@ + check: compile test.xml test.query test.query_parse -echo check.query not complete yet @@ -431,7 +439,8 @@ install: ${INSTALL} -m 755 ${LCAS_PLUGIN_LIB} ${DESTDIR}${PREFIX}${prefix}/${libdir}/modules; \ ln -sf liblcas_lb.so ${DESTDIR}${PREFIX}${prefix}/${libdir}/modules/lcas_lb.mod; \ fi - ${INSTALL} -m 755 ${top_srcdir}/src/notif-keeper.sh ${DESTDIR}${PREFIX}${prefix}/sbin/glite-lb-notif-keeper + ${INSTALL} -m 755 export.sh ${DESTDIR}${PREFIX}${prefix}/sbin/glite-lb-export + ${INSTALL} -m 755 notif-keeper.sh ${DESTDIR}${PREFIX}${prefix}/sbin/glite-lb-notif-keeper for f in dbsetup.sql index.conf.template; do \ ${INSTALL} -m 644 ${top_srcdir}/config/"glite-lb-$$f" ${DESTDIR}${PREFIX}${sysconfdir}/glite-lb; \ @@ -458,7 +467,7 @@ ifdef LB_PERF endif clean: - rm -rvf *.c *.cpp *.h *.ch *.xh *.xml *.nsmap *.o *.lo .libs glite-lb-bkindex glite-lb-bkserverd glite-lb-mon-db ${STATIC_LIB_BK} ${LCAS_PLUGIN_LIB} ${TESTS} ${MAN_GZ} ${EXAMPLES} ${SCRIPTS} ${MAN_GZ} + rm -rvf *.c *.cpp *.h *.ch *.xh *.xml *.nsmap *.o *.lo .libs glite-lb-bkindex glite-lb-bkserverd glite-lb-mon-db ${STATIC_LIB_BK} ${LCAS_PLUGIN_LIB} ${TESTS} ${MAN_GZ} ${EXAMPLES} ${SCRIPTS} ${SCRIPTS2} ${MAN_GZ} rm -rvf test_xml.cpp rm -rvf dist ${package}-*.tar.gz diff --git a/org.glite.lb.server/config/glite-lb b/org.glite.lb.server/config/glite-lb index 18daf93..285d4cf 100644 --- a/org.glite.lb.server/config/glite-lb +++ b/org.glite.lb.server/config/glite-lb @@ -28,6 +28,11 @@ GLITE_WMS_QUERY_TIMEOUT=300 # purge timeouts GLITE_LB_EXPORT_PURGE_ARGS='--cleared 2d --aborted 15d --cancelled 15d --other 60d' +# glite-info + +#SITE_NAME= +#SITE_EMAIL= + # # L&B configuration # diff --git a/org.glite.lb.server/config/glite-lb-proxy-purge.cron b/org.glite.lb.server/config/glite-lb-proxy-purge.cron index edc1ea9..0c522db 100644 --- a/org.glite.lb.server/config/glite-lb-proxy-purge.cron +++ b/org.glite.lb.server/config/glite-lb-proxy-purge.cron @@ -1 +1 @@ -31 1 * * * glite ( test -f /etc/profile.d/grid-env.sh || exit 0; . /etc/profile.d/grid-env.sh; export GLITE_LB_EXPORT_BKSERVER=$HOSTNAME; export GLITE_LB_PURGE_TARGET_RUNTIME=84600s; export GLITE_LB_PURGE_OTHER_OPTIONS="$GLITE_LB_PURGE_OTHER_OPTIONS -x"; printf "`date "+\%b \%e \%T"` `hostname -s` glite-lb-export.sh: "; @glite_prefix@/sbin/glite-lb-export.sh ) >> /var/log/glite/glite-lb-server-purge-proxy.log 2>&1 +31 1 * * * glite ( export GLITE_LB_EXPORT_BKSERVER=`hostname -f`; export GLITE_LB_PURGE_TARGET_RUNTIME=84600s; export GLITE_LB_PURGE_OTHER_OPTIONS="$GLITE_LB_PURGE_OTHER_OPTIONS -x"; printf "`date "+\%b \%e \%T"` `hostname -s` glite-lb-export: "; @glite_prefix@/sbin/glite-lb-export ) >> /var/log/glite/glite-lb-server-purge-proxy.log 2>&1 diff --git a/org.glite.lb.server/config/glite-lb-server-purge.cron b/org.glite.lb.server/config/glite-lb-server-purge.cron index bb8e5ab..a393f36 100644 --- a/org.glite.lb.server/config/glite-lb-server-purge.cron +++ b/org.glite.lb.server/config/glite-lb-server-purge.cron @@ -1 +1 @@ -1 1 * * * glite ( test -f /etc/profile.d/grid-env.sh || exit 0; . /etc/profile.d/grid-env.sh; export GLITE_LB_EXPORT_BKSERVER=$HOSTNAME; export GLITE_LB_PURGE_TARGET_RUNTIME=84600s; printf "`date "+\%b \%e \%T"` `hostname -s` glite-lb-export.sh: "; @glite_prefix@/sbin/glite-lb-export.sh ) >> /var/log/glite/glite-lb-server-purge.log 2>&1 +1 1 * * * glite ( export GLITE_LB_EXPORT_BKSERVER=`hostname -f`; export GLITE_LB_PURGE_TARGET_RUNTIME=84600s; printf "`date "+\%b \%e \%T"` `hostname -s` glite-lb-export: "; @glite_prefix@/sbin/glite-lb-export ) >> /var/log/glite/glite-lb-server-purge.log 2>&1 diff --git a/org.glite.lb.server/config/setup b/org.glite.lb.server/config/setup index ea04d70..e4c7590 100755 --- a/org.glite.lb.server/config/setup +++ b/org.glite.lb.server/config/setup @@ -371,6 +371,7 @@ fi if test "$setup_bdii" = "1"; then export INFO_SERVICE_CONFIG='/etc/glite/info/service' + bdii=0 if test -x /etc/init.d/bdii; then if test -f ${INFO_SERVICE_CONFIG}/glite-info-service-lbserver.conf.template -a -f ${INFO_SERVICE_CONFIG}/glite-info-glue2-lbserver.conf.template; then bdii=1 @@ -398,6 +399,7 @@ EOF sed -i "s#.*rootpw.*#rootpw ${BDII_PASSWD}#" /etc/bdii/bdii-slapd.conf if test -x /sbin/service; then + /sbin/chkconfig bdii on out="`/sbin/service bdii restart 2>&1`" else out="`/etc/init.d/bdii restart 2>&1`" @@ -518,7 +520,6 @@ if test "$setup_startup" = "1" -a "$startup_error" != "1"; then fi else /sbin/chkconfig mysqld on - test -z "$bdii" && /sbin/chkconfig bdii on /sbin/chkconfig glite-lb-bkserverd on /sbin/chkconfig glite-lb-locallogger on if test x"$GLITE_LB_HARVETER_ENABLED" = x"true"; then @@ -532,7 +533,9 @@ if test "$setup_startup" = "1" -a "$startup_error" != "1"; then if test x"$GLITE_LB_HARVESTER_ENABLED" = x"true"; then $GLITE_LOCATION_ETC/init.d/glite-lb-harvester restart || startup_error=1 else - $GLITE_LOCATION_ETC/init.d/glite-lb-harvester stop >/dev/null + if test -x $GLITE_LOCATION/bin/glite-lb-harvester; then + $GLITE_LOCATION_ETC/init.d/glite-lb-harvester stop >/dev/null + fi fi if test "$startup_error" = "0"; then diff --git a/org.glite.lb.client/src/export.sh b/org.glite.lb.server/src/export.sh.in similarity index 88% rename from org.glite.lb.client/src/export.sh rename to org.glite.lb.server/src/export.sh.in index 103247e..8f18315 100644 --- a/org.glite.lb.client/src/export.sh +++ b/org.glite.lb.server/src/export.sh.in @@ -17,12 +17,19 @@ # # -# script for exporing jobs from bkserver which should be periodically run -# together with running jp-importer -# -# it uses configuration from enviroment ==> may require a configuration wrapper +# script for purging jobs from bkserver which should be run periodically +# jobs export and import into Job Provenance may be optionally enabled # +GLITE_LB_LOCATION_VAR=${GLITE_LB_LOCATION_VAR:-'@glite_var@'} +GLITE_USER=${GLITE_USER:-'glite'} +GLITE_HOME=`getent passwd ${GLITE_USER} | cut -d: -f6` +GLITE_HOST_CERT=${GLITE_HOST_CERT:-"$GLITE_HOME/.certs/hostcert.pem"} +GLITE_HOST_KEY=${GLITE_HOST_KEY:-"$GLITE_HOME/.certs/hostkey.pem"} + +[ -f /etc/profile.d/grid-env.sh ] && . /etc/profile.d/grid-env.sh +[ -f @defaultdir@/glite-lb ] && . @defaultdir@/glite-lb + #autodetect the prefix PREFIX=${GLITE_LOCATION:-`dirname $0`/..} diff --git a/org.glite.lb.server/src/notif-keeper.sh b/org.glite.lb.server/src/notif-keeper.sh.in similarity index 98% rename from org.glite.lb.server/src/notif-keeper.sh rename to org.glite.lb.server/src/notif-keeper.sh.in index f40793d..8ec472b 100644 --- a/org.glite.lb.server/src/notif-keeper.sh +++ b/org.glite.lb.server/src/notif-keeper.sh.in @@ -16,7 +16,10 @@ # limitations under the License. # -GLITE_LOCATION=${GLITE_LOCATION:-"/opt/glite"} +GLITE_LOCATION=${GLITE_LOCATION:-"@glite_prefix@"} +[ -f /etc/profile.d/grid-env.sh ] && . /etc/profile.d/grid-env.sh +[ -f @defaultdir@/glite-lb ] && . @defaultdir@/glite-lb + NOTIFY=${GLITE_LB_NOTIFY:-"$GLITE_LOCATION/bin/glite-lb-notify"} # This function reads the full list of notifications to maintain into an array -- 1.8.2.3