[Opensrf-commits] r1451 - trunk/bin

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Oct 10 18:16:41 EDT 2008


Author: erickson
Date: 2008-10-10 18:16:36 -0400 (Fri, 10 Oct 2008)
New Revision: 1451

Modified:
   trunk/bin/opensrf-perl.pl
Log:
added verbose option to print which services/pids are being stopped/started

Modified: trunk/bin/opensrf-perl.pl
===================================================================
--- trunk/bin/opensrf-perl.pl	2008-10-07 14:38:29 UTC (rev 1450)
+++ trunk/bin/opensrf-perl.pl	2008-10-10 22:16:36 UTC (rev 1451)
@@ -32,6 +32,7 @@
 my $opt_no_daemon = 0;
 my $opt_settings_pause = 0;
 my $opt_help = 0;
+my $verbose = 0;
 my $sclient;
 my $hostname = hostfqdn();
 my @hosted_services;
@@ -44,6 +45,7 @@
     'no-daemon' => \$opt_no_daemon,
     'settings-startup-pause=i' => \$opt_settings_pause,
     'help' => \$opt_help,
+    'verbose' => \$verbose,
 );
 
 
@@ -65,6 +67,8 @@
     my $pid_file = get_pid_file($service);
     if(-e $pid_file) {
         my $pid = `cat $pid_file`;
+        chomp $pid;
+        msg("stopping servivce pid=$pid $service", 1);
         kill('INT', $pid);
         waitpid($pid, 0);
         unlink $pid_file;
@@ -126,6 +130,7 @@
 }
 
 sub do_start_all {
+    msg("starting all services for $hostname", 1);
     if(grep {$_ eq 'opensrf.settings'} @hosted_services) {
         do_start('opensrf.settings');
         # in batch mode, give opensrf.settings plenty of time to start 
@@ -139,6 +144,7 @@
 }
 
 sub do_stop_all {
+    msg("stopping all services for $hostname", 1);
     do_stop($_) for @hosted_services;
     return 1;
 }
@@ -150,6 +156,7 @@
     my $pid_file = get_pid_file($service);
     #exit if OpenSRF::Utils::safe_fork();
     return 0 if OpenSRF::Utils::safe_fork();
+    msg("starting servivce pid=$$ $service", 1);
     chdir('/');
     setsid();
     close STDIN;
@@ -195,7 +202,8 @@
 
 sub msg {
     my $m = shift;
-    print "* $m\n";
+    my $v = shift;
+    print "* $m\n" unless $v and not $verbose;
 }
 
 sub do_help {



More information about the opensrf-commits mailing list