From dad3170186b21675eb5dd883ff77d8f7d9fd3e36 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Fri, 14 Oct 2005 14:15:17 +0000 Subject: [PATCH] Finish & simplify the startup script, update doc, no feeds w/o GLITE_JPIS_PS. --- org.glite.jp.index/config/startup | 25 ++----------------------- org.glite.jp.index/src/conf.c | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/org.glite.jp.index/config/startup b/org.glite.jp.index/config/startup index b667a1e..b3f71f2 100755 --- a/org.glite.jp.index/config/startup +++ b/org.glite.jp.index/config/startup @@ -27,30 +27,9 @@ unset creds port start() { -# if test -z "$GLITE_USER" ;then -# echo 'Error: GLITE_USER is not set' -# echo FAILED -# return 1 -# fi - - [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] && - creds="-c $GLITE_HOST_CERT -k $GLITE_HOST_KEY" - - if test -z "$creds"; then - if su - $GLITE_USER -c "test -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem"; then - echo "$0: WARNING: /etc/grid-security/hostkey.pem readable by $GLITE_USER" - creds="-c /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem" - fi - fi - -# not used for now -# [ -z "$creds" ] && echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2 - echo -n Starting glite-jp-indexd ... -# su - $GLITE_USER -c -"$GLITE_LOCATION/bin/glite-jp-indexd \ - " && echo " done" || echo " FAILED" -# $creds -i $pidfile $port" + $GLITE_LOCATION/bin/glite-jp-indexd > $GLITE_LOCATION_VAR/log/glite-jp-index.log 2>&1 & + echo " done" } stop() diff --git a/org.glite.jp.index/src/conf.c b/org.glite.jp.index/src/conf.c index 0c6596a..dc67a7d 100644 --- a/org.glite.jp.index/src/conf.c +++ b/org.glite.jp.index/src/conf.c @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -12,6 +13,8 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf **configuration) { + char *ps = NULL; + // read comman line options and configuration file // XXX: use EGEE global configure tools in future... @@ -19,7 +22,11 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf conf = calloc(1, sizeof(*conf)); - + + // configuration from environment + conf->cs = getenv("GLITE_JPIS_DB"); + conf->port = getenv("GLITE_JPIS_PORT"); + // prefixes & attributes defined in: // lb.server/build/jp_job_attrs.h (created when build plugin) // jp.common/interfaces/known_attr.h @@ -56,13 +63,19 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf // XXX: some plugin names should come here in future conf->plugins = NULL; +// ps = "http://umbar.ics.muni.cz:8901"; + if (!ps && ((ps = getenv("GLITE_JPIS_PS")) == NULL)) { + printf("No JP PrimaryStrorage server specified in $GLITE_JPIS_PS, default feeds skipped.\n"); + conf->feeds = calloc(1, sizeof(*(conf->feeds))); + *configuration = conf; + return 0; + } /* ask for one feed */ conf->feeds = calloc(2, sizeof(*(conf->feeds))); conf->feeds[0] = calloc(1, sizeof(**(conf->feeds))); -// conf->feeds[0]->PS_URL = strdup("http://umbar.ics.muni.cz:8901"); - conf->feeds[0]->PS_URL = strdup("http://localhost:8901"); + conf->feeds[0]->PS_URL = strdup(ps); // all job since Epoche conf->feeds[0]->query = calloc(2,sizeof(*conf->feeds[0]->query)); @@ -76,9 +89,6 @@ int glite_jp_get_conf(int argc, char **argv, char *config_file, glite_jp_is_conf conf->feeds[1] = NULL; - conf->cs = getenv("GLITE_JPIS_DB"); - conf->port = getenv("GLITE_JPIS_PORT"); - *configuration = conf; return 0; -- 1.8.2.3