This plugin automatically restarts Aseco upon the event of a crash, and allows you to restart it ingame via the '/admin restartaseco' command (authorized by 'adminsuper' authitem).
Installation: Edit the 'res_script_path' and 'res_script_file' values at the top of the code below, then save into a php file in your plugins directory, then add the plugin to the 'plugins.xml' file
Code: Select all
<?php
class Auto_Restart extends Plugin {
// Set the path to the script to run Aseco here...
// Linux ex: '/home/user_dir/aseco_dir/'
// Win ex: 'C:\dir\aseco_dir'
var $res_script_path = '';
// Set the name of the start script here...
// Linux ex: 'Aseco.sh'
// Win ex: 'Aseco.bat'
var $res_script_file = '';
//Don't touch
var $running = true;
function on_crash () {
$this->Aseco->console('[AUTO-RES] Aseco shutting down... attempting to restart.');
$this->auto_restart();
}
function auto_restart () {
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$exec = 'start /d '.$this->res_script_path.' '.$this->res_script_file;
} else {
$exec = 'cd '.$this->res_script_path.';sh '.$this->res_script_file;
}
$this->running or exec($exec);
}
function chat_crash () {
$this->Aseco->console('[AUTO-RES] Restarting Aseco...');
$this->running = false;
$this->running or die();
}
}
$_PLUGIN = new Auto_Restart();
$_PLUGIN->setAuthor('-nocturne=-');
$_PLUGIN->setVersion(.62);
$_PLUGIN->setDescription('Restarts aseco on crash... whatd you expect?');
$_PLUGIN->addEvent('onServerCrash', 'on_crash');
$_PLUGIN->addChatCommand('admin restartaseco', 'chat_crash', 'Restart Aseco', 'ADMINSUPER');
?>