From 1fcb2f1338ef116c6736d3a4b2cdcfa0b2706029 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/ILS/trunk@1939 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/openils.xml.example | 10 ++++++ Open-ILS/src/Makefile | 2 -- OpenSRF/bin/opensrf_all | 2 +- OpenSRF/src/libstack/osrf_system.c | 50 ++++++++++++++------------ OpenSRF/src/perlmods/OpenSRF/System.pm | 11 ++++-- OpenSRF/src/router/osrf_router_main.c | 1 - 6 files changed, 48 insertions(+), 28 deletions(-) diff --git a/Open-ILS/examples/openils.xml.example b/Open-ILS/examples/openils.xml.example index 04ee16a14c..5b74fc7636 100644 --- a/Open-ILS/examples/openils.xml.example +++ b/Open-ILS/examples/openils.xml.example @@ -68,6 +68,7 @@ For non-core config info, see the inline documentation within this file 1 1 + perl OpenSRF::Application::Persist 97 @@ -91,6 +92,7 @@ For non-core config info, see the inline documentation within this file 5 1 + perl OpenILS::Application::Auth 93 @@ -118,6 +120,7 @@ For non-core config info, see the inline documentation within this file 5 1 + perl OpenILS::Application::Search 93 @@ -145,6 +148,7 @@ For non-core config info, see the inline documentation within this file 5 1 + perl OpenILS::Application::Actor 93 @@ -167,6 +171,7 @@ For non-core config info, see the inline documentation within this file 5 1 + perl OpenILS::Application::Cat 199 @@ -194,6 +199,7 @@ For non-core config info, see the inline documentation within this file 3 1 + perl OpenSRF::Application::Demo::Math 97 @@ -211,6 +217,7 @@ For non-core config info, see the inline documentation within this file 3 1 + perl OpenSRF::Application::Demo::MathDB 99 @@ -228,6 +235,7 @@ For non-core config info, see the inline documentation within this file 3 1 + perl OpenILS::Application::Circ 99 @@ -258,6 +266,7 @@ For non-core config info, see the inline documentation within this file 3 1 + perl OpenILS::Application::Storage 1000 @@ -291,6 +300,7 @@ For non-core config info, see the inline documentation within this file 1 1 + perl OpenSRF::Application::Settings 17 diff --git a/Open-ILS/src/Makefile b/Open-ILS/src/Makefile index 309eba8b17..029afe618d 100644 --- a/Open-ILS/src/Makefile +++ b/Open-ILS/src/Makefile @@ -8,8 +8,6 @@ export INCDIR = "$(INCLUDEDIR)/openils/" all: mod_xmltools mod_ils_rest_gateway c_apps - - install: perl-install web-install string-templates-install storage-bootstrap cgi-bootstrap xsl-install c_apps-install web-install: webcore-install autojs-install mod_xmltools-install mod_ils_rest_gateway-install diff --git a/OpenSRF/bin/opensrf_all b/OpenSRF/bin/opensrf_all index c337284052..40b9dc429e 100755 --- a/OpenSRF/bin/opensrf_all +++ b/OpenSRF/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/OpenSRF/src/libstack/osrf_system.c b/OpenSRF/src/libstack/osrf_system.c index eac1c692d6..419bdacfbb 100644 --- a/OpenSRF/src/libstack/osrf_system.c +++ b/OpenSRF/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/OpenSRF/src/perlmods/OpenSRF/System.pm b/OpenSRF/src/perlmods/OpenSRF/System.pm index b657857d2f..8a5f90c340 100644 --- a/OpenSRF/src/perlmods/OpenSRF/System.pm +++ b/OpenSRF/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/OpenSRF/src/router/osrf_router_main.c b/OpenSRF/src/router/osrf_router_main.c index 8d715cde0b..e29bf92ff0 100644 --- a/OpenSRF/src/router/osrf_router_main.c +++ b/OpenSRF/src/router/osrf_router_main.c @@ -101,7 +101,6 @@ int __setupRouter( char* config, char* context ) { osrfRouterRun( router ); return -1; - } -- 2.43.2