mmmd_agent
来自「mysql+ha. 实现高可用性 http://code.google.com」· 代码 · 共 64 行
TXT
64 行
#!/usr/bin/env perl# Use mandatory external modulesuse strict;use Cwd;use File::Basename;use Data::Dumper;use POSIX;use Config;use Getopt::Long;use IO::Socket;use Proc::Daemon;use Time::HiRes;# Determine installation dir nameour $SELF_DIR = dirname(dirname(Cwd::abs_path(__FILE__)));# Include parts of the systemrequire $SELF_DIR . '/lib/config.pm';require $SELF_DIR . '/lib/log.pm';require $SELF_DIR . '/lib/agent_commands.pm';#-----------------------------------------------------------------# Read config fileour $config = ReadConfig("mmm_agent.conf");# We need to know how previous session has been finishedour $unclean_start = CheckPidFile();# Go to backgroundProc::Daemon::Init if ($config->{debug} =~ /^(off|no|0)$/i);CreatePidFile();# Shutdown flagour $shutdown = 0;# Start time to calculate uptimeour $start_time = time();# Catch signals$SIG{INT} = \&SignalHandler;$SIG{TERM} = \&SignalHandler;#-----------------------------------------------------------------# Initialize server statusour $server_version = -1;our $server_state = 'UNKNOWN';our $server_roles = ();our $active_master = "";# Start command handlerCommandMain();# Delete pid file and update status fileunlink($config->{pid_path});exit(0);#-----------------------------------------------------------------sub SignalHandler() { LogDebug("Core: Signal received: exiting..."); $shutdown = 1;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?