[ASECO2.x] Plugin | AutoRes v.62

This forum is dedicated to the Aseco/Rasp 2 server records and control script by Flo and Assembler Maniac. Announcements and issues can be discussed in this forum.

Moderators: Flo, f*ckfish, Assembler Maniac, TM-Patrol

Post Reply
nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

[ASECO2.x] Plugin | AutoRes v.62

Post by nocturne » 19 Sep 2009 17:01

AutoRes v.62...........Level: Intermediate
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');
?>

nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

Re: [ASECO2.x] Plugin | AutoRes v.62

Post by nocturne » 19 Sep 2009 17:08

Oh, and... *Use at your own risk...* :twisted:

User avatar
oliverde8
solid chaser
solid chaser
Posts: 1135
Joined: 07 Oct 2006 07:03
Owned TM-games: TMU
Manialink(s): oliverde8
Location: Turkey
Contact:

Re: [ASECO2.x] Plugin | AutoRes v.62

Post by oliverde8 » 19 Sep 2009 17:53

Don't Aseco restart automatically laready on Windows?

And on Linux wouldn't it be easier to change the aseco.sh file?
ImageImage
Manialink : oliverde8color>
Servers : STATS <> United | VeryShort | Made In Turkey

nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

Re: [ASECO2.x] Plugin | AutoRes v.62

Post by nocturne » 19 Sep 2009 18:33

oliverde8 wrote:Don't Aseco restart automatically laready on Windows?

And on Linux wouldn't it be easier to change the aseco.sh file?
On either linux or windows, the script won't automatically restart itself unless it's run within a loop in the start script.

I personally chose this method since it works well with the pid handling scripts I hacked up (for status monitoring), and... it's simple! No sloppy loops or extra processes. And, also gives you the ability to restart aseco ingame.

PoDz
pedestrian
pedestrian
Posts: 13
Joined: 30 Nov 2009 01:51
Owned TM-games: ALL

Re: [ASECO2.x] Plugin | AutoRes v.62

Post by PoDz » 08 May 2010 18:05

Hi,

I'm getting this:
Fatal error: Call to undefined method Auto_Restart::addEvent() in /home/......../plugin.Auto_Restart.php on line 44

I'm using xaseco 1.10.
line 44: $_PLUGIN->addEvent('onServerCrash', 'on_crash');

Thanks.

User avatar
TheM
Pit Crew
Pit Crew
Posts: 286
Joined: 25 Feb 2009 16:43
Owned TM-games: TMU(F), TMN(F), TM2
Location: Brabant, Netherlands
Contact:

Re: [ASECO2.x] Plugin | AutoRes v.62

Post by TheM » 09 May 2010 08:04

PoDz wrote:Hi,

I'm getting this:
Fatal error: Call to undefined method Auto_Restart::addEvent() in /home/......../plugin.Auto_Restart.php on line 44

I'm using xaseco 1.10.
line 44: $_PLUGIN->addEvent('onServerCrash', 'on_crash');

Thanks.
Please first look at the topic title before posting such questions.
As you're already telling us is that you are running XASECO v1.10,
the forum you're posting in is for ASECO/RASP 2.x.
This is a different system then XASECO and you can't use it's plugins in XASECO.

I dunno if this plugin also exists for XASECO, otherwise you'll have to port it ;)
Or use ASECO/RASP ofcourse.

nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

Re: [ASECO2.x] Plugin | AutoRes v.62

Post by nocturne » 09 May 2010 16:11

There was an xaseco equivalent (sort of), but it's a bit more complicated to use. Honestly, though... It's not much use anyways -- auto restart doesn't always work (such as with fatal php errors), and you have to be knowledgeable enough to set up your own start script (in which case you can run the script in a loop anyways, making it even more redundant). It was just the best option available that was compatible with my previous host, and I figured it wouldn't hurt posting it.

Post Reply