LP#1286198: Offer ability to ignore what seem like orphan processes when starting...
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 31 Jan 2014 20:50:01 +0000 (15:50 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 7 Mar 2014 16:01:13 +0000 (08:01 -0800)
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

bin/opensrf-perl.pl.in

index a939efe..c95e2b3 100755 (executable)
@@ -61,6 +61,7 @@ my $opt_reload = 0;
 my $opt_reload_all = 0;
 my $opt_quiet = 0;
 my $opt_diagnostic = 0;
+my $opt_ignore_orphans = 0;
 my $sclient;
 my @perl_services;
 my @nonperl_services;
@@ -101,7 +102,8 @@ GetOptions(
     'router-re-register-all' => \$opt_router_re_register_all,
     'reload' => \$opt_reload,
     'reload-all' => \$opt_reload_all,
-    'diagnostic' => \$opt_diagnostic
+    'diagnostic' => \$opt_diagnostic,
+    'are-there-no-prisons' => \$opt_ignore_orphans
 );
 
 if ($opt_localhost) {
@@ -369,7 +371,7 @@ sub do_start {
             unlink $pidfile;
         }
 
-    } elsif (@ps_pids) { # orphan process
+    } elsif (@ps_pids and not $opt_ignore_orphans) { # orphan process
 
         if ($opt_force_clean_process) {
             msg("service $service pid=@ps_pids is running with no pidfile");
@@ -666,7 +668,12 @@ sub do_help {
     --force-clean-process
         When starting a service, if a service process is already running 
         but no pidfile exists, kill the service process before starting
-        the new one.
+        the new one. This applies to routers too.
+
+    --are-there-no-prisons
+        When starting a service, if a service procses is already running but
+        no pidfile exists, ignore the existing process and carry on starting
+        the new one (i.e., ignore orphans).  This applies to routers too.
 
     ==== stopping services =====