#!/bin/sh # Auto Start Server Script by Latheesan (Admin of Nemesis-WarCraft.Com) , AKA Shinigami2007 # Your Linux SSH Account Name # Very important !!! This is the username you use to login to your SSH to control your Ascent Emulator # We can use $(whoami) to automatically determine the username, if this isnt working, manually enter it ACC=$(whoami) # Ascent Server Binary files path Logon_Server=ascent-logonserver World_Server=ascent-world # Set this to 1 if you want to disable this script aut-restarting your ascent logon/world server during # svn updating for example Disabled=0 ########################## # End Of Configuration # ########################## # Function to check if the server binary files exist, according to the config Check_Config() { for i in ${Logon_Server} ${World_Server} do if [ ! -f ./$i ]; then echo "Error : Could Not Find $i" exit; fi done } # Function to get the process id of logon server, if its running GET_Logon_PID() { logon_pid=$(pgrep -u ${ACC} -f ascent-logonserver) if [ ${logon_pid} ]; then logon_ss=1 else logon_ss=0 fi } # Function to get the pid of map server, if its running GET_World_PID() { world_pid=$(pgrep -u ${ACC} -f ascent-world) if [ ${world_pid} ]; then world_ss=1 else world_ss=0 fi } # Run the function to check if the Ascent binary files are there Check_Config # Run the function to get the logon and world server process IDs GET_Logon_PID GET_World_PID # Check if this script is disabled if [ ${Disabled} -eq 1 ]; then echo "This script is disabled" echo "Edit this file auto_ascent and configure the script like this: Disabled=0" exit; fi # Check if Logon server is down, If it is, then restart it if [ ${logon_ss} -eq 1 ]; then echo "Logon Server Is Running Fine" else echo "Logon Server Is DOWN, Restarting It" echo -e `date '+%D %T'`"\tLogon Server Is DOWN, Restarting It" >> auto_ascent_log.txt exec ./${Logon_Server}; fi # Check if World server is down, if it is, then restart it if [ ${world_ss} -eq 1 ]; then echo "World Server Is Running Fine" else echo "World Server Is DOWN, Restarting It" echo -e `date '+%D %T'`"\tWorld Server Is DOWN, Restarting It" >> auto_ascent_log.txt exec ./${World_Server}; fi