• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[ModernAAC] Start server from AAC (Linux only)

JoccE

CopyLeft (ɔ)
Joined
Aug 26, 2007
Messages
3,418
Solutions
1
Reaction score
92
Location
Sweden, Stockholm
So.. After some testing and learning some about modern aac here is the start/stop from web for Modern AAC :)

in /system/pages/adminstart.php add this:
PHP:
<?PHP 
if($ide->isAdmin()) { 
 if(isset($_POST['test'])) { 
    if (check_if_process_is_running("theforgottenserver"))
		{
			  echo "<h2><b><font color='green'>Server is already running</font></b></h2>";
		} else
		{
			  shell_exec('cd /home/server1/ && ./theforgottenserver > my.log 2>&1 &'); //Serverpath
		}
}
} 
if(isset($_POST['kill'])) { 
    shell_exec('killall -9 theforgottenserver'); 
} 
if(isset($_POST['safe'])) { 
    shell_exec('killall -QUIT theforgottenserver'); 
}

function check_if_process_is_running($process) 
{ 
    exec("/bin/pidof $process",$response); 
    if ($response) 
    { 
         return true; 
    } else 
    { 
         return false; 
    } 
} 
if (check_if_process_is_running("theforgottenserver")) 
    { 
          echo "<h2><b><font color='green'>Server is running</font></b></h2>"; 
    } else 
    { 
          echo "<h3><b><font color='red'>Server is NOT running</font></b></h3>"; 
} 

?>
    <script type="text/javascript"> 
        function newPopup(url) { 
        popupWindow = window.open( 
        url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
        } 
    </script> 
<div id="text"> 
        This is the beta version of JoccEs Admin panel to start/stop tibia servers<br> 
        <b>Functions:</b><br> 
        <b>Start:</b> Starts the server using ./theforgottenserver (no Autorestarter) Now with logging enabled.<br>  
        <b>Save and Quit:</b> Saves the server the stops it.<br> 
        <b>Kill Server:</b> Instantly Stops the server using "killall -9 theforgottenserver"<br> 
        <b>Logs:</b> Shows the startup output after you have shut down server (a bit buggy server need to be offline to read it) 
        <br> 
        <br> 
    </div> 
<!-- Buttons --> 
    <div id="buttons>"> 
        <!-- Start --> 
        <form action="<?=$_SERVER['PHP_SELF'];?>" method="post"> 
        <input type="submit" name="test" value="Start Server"> 
        </form> 
        <!-- Safe Stop -->  
        <form action="<?=$_SERVER['PHP_SELF'];?>" method="post"> 
        <input type="submit" name="safe" value="Save and Quit"> 
        </form>         
        <!-- Instant stop without save --> 
        <form action="<?=$_SERVER['PHP_SELF'];?>" method="post"> 
        <input type="submit" name="kill" value="Kill Server"> 
        </form> 
        <!-- Log Viewer --> 
        <button onclick="newPopup('my.log')">Startup Logs</button>    
    </div> 
<!-- Random Information --> 
    <div id="info"> 
        <br> 
        <b>Current Bugs:</b><br> 
        --NONE<br> 
        <br> 
        <b>Future Features:</b><br> 
        --Be able to start server with auto restarter.<br> 
        --More functions: Examples: Clean map and Save Server. (done just not added)<br>  
    </div> 
<?php
}
?>

Then the link too the admin panel is
PHP:
<li><a href="{$path}/index.php/p/v/adminstart">Adminstart</a></li>

REMEMBER TO CHANGE SERVER PATH ON LINE 4

Link for pic and more explanation: http://otland.net/f118/znoteacc-start-server-aac-linux-only-178056/
 
Last edited:
Improved script abit :p (Security issue)

Now you can't start the server if it is already running :)
 
Back
Top