Finish & simplify the startup script, update doc, no feeds w/o GLITE_JPIS_PS.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 14 Oct 2005 14:15:17 +0000 (14:15 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 14 Oct 2005 14:15:17 +0000 (14:15 +0000)
org.glite.jp.index/config/startup
org.glite.jp.index/src/conf.c

index b667a1e..b3f71f2 100755 (executable)
@@ -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()
index 0c6596a..dc67a7d 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <stdio.h>
 
 #include <glite/jp/types.h>
 #include <glite/jp/context.h>
@@ -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;