/usr/sbin/mmm_agentd is in mysql-mmm-agent 2.2.1-1.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | #!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
use English qw( PROGRAM_NAME );
use File::Basename;
use Proc::Daemon;
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($INFO);
# Define version and protocol version
use constant MMM_VERSION => '2.2.1';
use constant MMM_PROTOCOL_VERSION => 1;
# Include parts of the system
use MMM::Common::Angel;
use MMM::Common::Config;
use MMM::Common::Log;
use MMM::Common::PidFile;
use MMM::Agent::Agent;
# Maybe we were just asked for our version
if (scalar(@ARGV) && $ARGV[0] eq "--version") {
printf "%s %s\n", basename($PROGRAM_NAME), MMM_VERSION;
exit(0);
}
chdir('/');
umask(0022);
our $cluster_name = '';
my $postfix = '';
if (scalar(@ARGV) && $ARGV[0] =~ /^@(.*)/) {
shift(@ARGV);
$cluster_name = $1;
$postfix = "_$cluster_name";
$PROGRAM_NAME = basename($PROGRAM_NAME) . '-' . $cluster_name;
}
else {
$PROGRAM_NAME = basename($PROGRAM_NAME);
}
MMM::Common::Log::init("mmm_agent_log$postfix.conf", "mmm_agentd$postfix");
# Read configuration
our $config = new MMM::Common::Config::;
$config->read("mmm_agent$postfix");
$config->check('AGENT');
my $debug = $config->{debug};
MMM::Common::Log::debug() if ($debug);
our $agent = new MMM::Agent::Agent::(
protocol_version => 1,
active_master => '',
state => 'UNKNOWN',
config_file => "mmm_agent$postfix"
);
$agent->from_config($config);
my $pidfilename = $config->{host}->{ $config->{this} }->{pid_path};
my $pidfile = new MMM::Common::PidFile:: $pidfilename;
# Check pid file
LOGDIE "Can't run second copy of ", $PROGRAM_NAME if ($pidfile->is_running());
WARN "Unclean start - found stale pid file!" if ($pidfile->exists());
unless ($debug) {
# Go to background
Proc::Daemon::Init();
# Set umask again
umask(0022);
# Init logging again to re-open fds
MMM::Common::Log::init("mmm_agent_log$postfix.conf", "mmm_agentd$postfix");
}
# Init angel magic, which will restart us if we die unexpected
MMM::Common::Angel::Init($pidfile);
# Shutdown flag
our $shutdown = 0;
# Set signal handlers
$SIG{INT} = \&ShutdownHandler;
$SIG{TERM} = \&ShutdownHandler;
$SIG{QUIT} = \&ShutdownHandler;
$agent->main();
INFO 'END';
exit(0);
#-----------------------------------------------------------------
sub ShutdownHandler() {
INFO "Signal received: exiting...";
$shutdown = 1;
}
|