Offer ability to ignore what seem like orphan processes when starting things
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 31 Jan 2014 20:50:01 +0000 (15:50 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 31 Jan 2014 20:57:34 +0000 (15:57 -0500)
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
bin/opensrf-perl.pl.in

index 294288a..e0d4441 100755 (executable)
@@ -55,6 +55,7 @@ my $opt_restart_services = 0;
 my $opt_force_clean_process = 0;
 my $opt_quiet = 0;
 my $opt_diagnostic = 0;
+my $opt_ignore_orphans = 0;
 my $sclient;
 my @perl_services;
 my @nonperl_services;
@@ -89,7 +90,8 @@ GetOptions(
     'start-services' => \$opt_start_services,
     'stop-services' => \$opt_stop_services,
     'restart-services' => \$opt_restart_services,
-    'diagnostic' => \$opt_diagnostic
+    'diagnostic' => \$opt_diagnostic,
+    'are-there-no-prisons' => \$opt_ignore_orphans
 );
 
 if ($opt_localhost) {
@@ -357,7 +359,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");
@@ -654,7 +656,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 =====