You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by ar...@apache.org on 2016/01/11 21:48:23 UTC
svn commit: r1724127 -
/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/SysV.pm
Author: arkurth
Date: Mon Jan 11 20:48:23 2016
New Revision: 1724127
URL: http://svn.apache.org/viewvc?rev=1724127&view=rev
Log:
VCL-923
Updated SysV.pm::service_running. It was only checking for either of the following strings: "is running", "is not running". The daemon file included with the VCL code does not display "is not running", but "no vcld processes found". As a result, it wasn't able to determine if the vcld service was running. Added a regex to look for "no ... processes". Also added code to check the exit status if none of the strings match.
Modified:
vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/SysV.pm
Modified: vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/SysV.pm
URL: http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/SysV.pm?rev=1724127&r1=1724126&r2=1724127&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/SysV.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/init/SysV.pm Mon Jan 11 20:48:23 2016
@@ -319,19 +319,23 @@ sub service_running {
notify($ERRORS{'WARNING'}, 0, "'$service_name' service does not exist on $computer_node_name");
return;
}
- elsif (grep(/is running/i, @$output)) {
+ elsif (grep(/(is running)/i, @$output)) {
# Output if the service is running: '<service name> is running'
- notify($ERRORS{'DEBUG'}, 0, "'$service_name' service is running on $computer_node_name");
+ notify($ERRORS{'DEBUG'}, 0, "'$service_name' service is running on $computer_node_name, output:\n" . join("\n", @$output));
return 1;
}
- elsif (grep(/is not running/i, @$output)) {
+ elsif (grep(/(is not running|no\s.*process)/i, @$output)) {
# Output if the service is not running: '<service name> is not running'
- notify($ERRORS{'DEBUG'}, 0, "'$service_name' service is not running on $computer_node_name");
+ notify($ERRORS{'DEBUG'}, 0, "'$service_name' service is not running on $computer_node_name, output:\n" . join("\n", @$output));
return 0;
}
+ elsif ($exit_status == 0) {
+ notify($ERRORS{'DEBUG'}, 0, "unable to determine if '$service_name' service is running on $computer_node_name based on output but exit status of $command is $exit_status, assuming service is running, output:\n" . join("\n", @$output));
+ return 1;
+ }
else {
- notify($ERRORS{'WARNING'}, 0, "failed to determine if '$service_name' service is running on $computer_node_name, exit status: $exit_status, output:\n" . join("\n", @$output));
- return;
+ notify($ERRORS{'DEBUG'}, 0, "unable to determine if '$service_name' service is running on $computer_node_name based on output but exit status of $command is $exit_status, assuming service is NOT running, output:\n" . join("\n", @$output));
+ return 0;
}
}