add support of process signals
This commit is contained in:
parent
251988b19b
commit
93423e36af
@ -28,6 +28,9 @@ if (!ini_get('date.timezone') && function_exists('date_default_timezone_set')) {
|
|||||||
// Make sure garbage collection is enabled
|
// Make sure garbage collection is enabled
|
||||||
gc_enable();
|
gc_enable();
|
||||||
|
|
||||||
|
// Listen process signals
|
||||||
|
pcntl_async_signals(true);
|
||||||
|
|
||||||
// Register AutoLoader
|
// Register AutoLoader
|
||||||
require_once MANIACONTROL_PATH . 'core' . DIRECTORY_SEPARATOR . 'AutoLoader.php';
|
require_once MANIACONTROL_PATH . 'core' . DIRECTORY_SEPARATOR . 'AutoLoader.php';
|
||||||
\ManiaControl\AutoLoader::register();
|
\ManiaControl\AutoLoader::register();
|
||||||
|
@ -652,6 +652,11 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener,
|
|||||||
Logger::log('Starting ManiaControl v' . self::VERSION . '!');
|
Logger::log('Starting ManiaControl v' . self::VERSION . '!');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Manage SIGTERM signal
|
||||||
|
pcntl_signal(SIGTERM, function() {
|
||||||
|
$this->quit("Stop signal received from the OS.", false);
|
||||||
|
});
|
||||||
|
|
||||||
// Connect to server
|
// Connect to server
|
||||||
$this->connect();
|
$this->connect();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user