From 766b1f1a05dbdfbc78055bfb23b105d164a915d2 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 1 Nov 2005 22:01:21 +0000 Subject: [PATCH] added the block to the opensrf app config so the servers will know which apps they need to run e.g. c, perl case insensitve git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@560 9efc2488-bf62-4759-914b-345cdb29e865 --- bin/opensrf_all | 2 +- src/libstack/osrf_system.c | 50 +++++++++++++++++++--------------- src/perlmods/OpenSRF/System.pm | 11 ++++++-- src/router/osrf_router_main.c | 1 - 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/bin/opensrf_all b/bin/opensrf_all index c337284..40b9dc4 100755 --- a/bin/opensrf_all +++ b/bin/opensrf_all @@ -91,7 +91,7 @@ function startOpenSRF { if [ ! -z "$OPENSRFC" ]; then echo "Starting OpenSRF-C..."; # localhost will need to be changed... - "$BINDIR/opensrf-c" localhost "$ETCDIR//opensrf_core.xml" "opensrf" + "$BINDIR/opensrf-c" $(hostname -f) "$ETCDIR//opensrf_core.xml" "opensrf" echo "OpenSRF-C started OK"; fi } diff --git a/src/libstack/osrf_system.c b/src/libstack/osrf_system.c index eac1c69..419bdac 100644 --- a/src/libstack/osrf_system.c +++ b/src/libstack/osrf_system.c @@ -87,30 +87,36 @@ int osrfSystemBootstrap( char* hostname, char* configfile, char* contextNode ) { i = 0; while( (appname = osrfStringArrayGetString(arr, i++)) ) { - char* libfile = osrf_settings_host_value("/apps/%s/implementation", appname); - info_handler("Launching application %s with implementation %s", appname, libfile); + char* lang = osrf_settings_host_value("/apps/%s/language", appname); + + if(lang && !strcasecmp(lang,"c")) { + + char* libfile = osrf_settings_host_value("/apps/%s/implementation", appname); + + if(! (appname && libfile) ) { + warning_handler("Missing appname / libfile in settings config"); + continue; + } + + info_handler("Launching application %s with implementation %s", appname, libfile); + + int pid; + + if( (pid = fork()) ) { + // storage pid in local table for re-launching dead children... + info_handler("Launched application child %d", pid); - if(! (appname && libfile) ) { - warning_handler("Missing appname / libfile in settings config"); - continue; - } - - int pid; - - if( (pid = fork()) ) { - // storage pid in local table for re-launching dead children... - info_handler("Launched application child %d", pid); - - } else { + } else { + + fprintf(stderr, " * Running application %s\n", appname); + if( osrfAppRegisterApplication( appname, libfile ) == 0 ) + osrf_prefork_run(appname); - fprintf(stderr, " * Running application %s\n", appname); - if( osrfAppRegisterApplication( appname, libfile ) == 0 ) - osrf_prefork_run(appname); - - debug_handler("Server exiting for app %s and library %s", appname, libfile ); - exit(0); - } - } + debug_handler("Server exiting for app %s and library %s", appname, libfile ); + exit(0); + } + } // language == c + } } /** daemonize me **/ diff --git a/src/perlmods/OpenSRF/System.pm b/src/perlmods/OpenSRF/System.pm index b657857..8a5f90c 100644 --- a/src/perlmods/OpenSRF/System.pm +++ b/src/perlmods/OpenSRF/System.pm @@ -152,7 +152,9 @@ sub bootstrap { for my $app (@$apps) { # verify we are a settings server and launch - if( $app eq "opensrf.settings" ) { + if( $app eq "opensrf.settings" and + $client->config_value("apps","opensrf.settings", "language") =~ /perl/i ) { + $are_settings_server = 1; $self->launch_settings(); sleep 1; @@ -331,10 +333,15 @@ sub launch_settings_listener { sub launch_unix { my( $self, $apps ) = @_; + my $client = OpenSRF::Utils::SettingsClient->new(); + foreach my $app ( @$apps ) { + next unless $app; + my $lang = $client->config_value( "apps", $app, "language"); - if( $app eq "opensrf.settings" ) { next; } + next unless $lang =~ /perl/i; + next unless $app ne "opensrf.settings"; _log( " * Starting UnixServer for $app..." ); diff --git a/src/router/osrf_router_main.c b/src/router/osrf_router_main.c index 8d715cd..e29bf92 100644 --- a/src/router/osrf_router_main.c +++ b/src/router/osrf_router_main.c @@ -101,7 +101,6 @@ int __setupRouter( char* config, char* context ) { osrfRouterRun( router ); return -1; - } -- 2.43.2