📄 mmmd_agent
字号:
#!/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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -