Fix --stop to look for stop-<service> instead of disable-<service>.

This commit is contained in:
Daniel Nichter
2013-05-08 14:11:15 -07:00
parent c78574d5d5
commit 72616620b4
+6 -5
View File
@@ -6649,8 +6649,8 @@ sub stop_agent {
: "$FindBin::Bin/"; : "$FindBin::Bin/";
if ( !-f $pid_file ) { if ( !-f $pid_file ) {
_warn("PID file $pid_file does not exist; you must stop " _info("PID file $pid_file does not exist; if pt-agent is running, "
. "pt-agent manually"); . "use kill -ABRT to force it to stop.");
} }
else { else {
chop(my $pid = slurp($pid_file)); chop(my $pid = slurp($pid_file));
@@ -6709,21 +6709,22 @@ sub stop_agent {
if ( -d "$lib_dir/services" ) { if ( -d "$lib_dir/services" ) {
my $env_vars = env_vars(); my $env_vars = env_vars();
_info("Disabling all services (clean up)..."); _info("Stopping all services...");
SERVICE: SERVICE:
foreach my $file ( glob "$lib_dir/services/disable-*" ) { foreach my $file ( glob "$lib_dir/services/stop-*" ) {
my $service = basename($file); my $service = basename($file);
my $disable_log = "$lib_dir/logs/$service.stop"; my $disable_log = "$lib_dir/logs/$service.stop";
my $cmd = ($env_vars ? "$env_vars " : '') my $cmd = ($env_vars ? "$env_vars " : '')
. "${bin_dir}pt-agent --run-service $service" . "${bin_dir}pt-agent --run-service $service"
. " </dev/null" . " </dev/null"
. " >$disable_log 2>&1"; . " >$disable_log 2>&1";
_info("Running $cmd");
PTDEBUG && _d($cmd); PTDEBUG && _d($cmd);
system($cmd); system($cmd);
my $cmd_exit_status = $CHILD_ERROR >> 8; my $cmd_exit_status = $CHILD_ERROR >> 8;
if ( $cmd_exit_status != 0 ) { if ( $cmd_exit_status != 0 ) {
my $err = slurp($disable_log); my $err = slurp($disable_log);
_warn("Error running $service: " . ($err || '')); _warn("Error stopping $service: " . ($err || ''));
next SERVICE; next SERVICE;
} }
unlink $disable_log unlink $disable_log