07-18-2013, 05:41 PM
Finally get the restart on crash script working in linux, with crontab.
if you want to use it, remember that it assumes that MCServer executable is in /MCS directory.
PHP Code:
<?php
$url = 'localhost';
$port = 25565;
$pauseLength = 10;
$fp = @pfsockopen($url, $port);
if (!$fp) {
echo 'SERVER DOWN! Rebooting it.',"\r\n";
`/usr/bin/pkill MCServer`;
sleep($pauseLength);
`cd /MCS`;
`./MCServer`;
} else {
echo 'SERVER UP :)';
}
?>