Browse Source
*Fixed map compressor * Stopped error on first run stating that ${constolelog} is missing. *Minor code tidy uppull/30/head
1 changed files with 53 additions and 47 deletions
@ -3,7 +3,7 @@ |
|||||
# Server Management Script |
# Server Management Script |
||||
# Author: Daniel Gibbs |
# Author: Daniel Gibbs |
||||
# Website: http://danielgibbs.co.uk |
# Website: http://danielgibbs.co.uk |
||||
# Version: 011013 |
# Version: 101113 |
||||
|
|
||||
#### Variables #### |
#### Variables #### |
||||
|
|
||||
@ -13,7 +13,7 @@ emailnotification="off" |
|||||
email="[email protected]" |
email="[email protected]" |
||||
|
|
||||
# Directorys |
# Directorys |
||||
rootdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )" |
||||
selfname="$0" |
selfname="$0" |
||||
filesdir="${rootdir}/serverfiles" |
filesdir="${rootdir}/serverfiles" |
||||
systemdir="${filesdir}/System" |
systemdir="${filesdir}/System" |
||||
@ -25,7 +25,7 @@ servicename="ut99-server" |
|||||
gamename="Unreal Tournament 99" |
gamename="Unreal Tournament 99" |
||||
engine="unreal" |
engine="unreal" |
||||
ini="${servicename}.ini" |
ini="${servicename}.ini" |
||||
servername=`grep -s ServerName= ${systemdir}/${ini} | sed 's/ServerName=//g'` |
servername=$(grep -s ServerName= ${systemdir}/${ini} | sed 's/ServerName=//g') |
||||
|
|
||||
# Logging |
# Logging |
||||
logdays="7" |
logdays="7" |
||||
@ -67,12 +67,13 @@ tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicen |
|||||
if [ ${tmuxwc} -eq 1 ];then |
if [ ${tmuxwc} -eq 1 ];then |
||||
fn_serverquery |
fn_serverquery |
||||
echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" |
echo -en "\r[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} is already running" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already running" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already running" >> ${scriptlog} |
||||
sleep 0.5 |
sleep 0.5 |
||||
echo -en "\n" |
echo -en "\n" |
||||
exit |
exit |
||||
fi |
fi |
||||
} |
} |
||||
|
|
||||
fn_compressmaps(){ |
fn_compressmaps(){ |
||||
fn_rootcheck |
fn_rootcheck |
||||
clear |
clear |
||||
@ -94,29 +95,34 @@ while true; do |
|||||
* ) echo "Please answer yes or no.";; |
* ) echo "Please answer yes or no.";; |
||||
esac |
esac |
||||
done |
done |
||||
mkdir ${compressedmapsdir} |
mkdir ${compressedmapsdir} > /dev/null 2>&1 |
||||
rm -rfv ${filesdir}/Maps/*.uz2 |
rm -rfv ${filesdir}/Maps/*.unr.uz |
||||
cd ${systemdir} |
cd ${systemdir} |
||||
./ucc-bin compress ../Maps/* --nohomedir |
for map in `ls ${filesdir}/Maps`; do |
||||
mv -fv ${filesdir}/Maps/*.uz2 ${compressedmapsdir} |
./ucc-bin compress ../Maps/${map} --nohomedir |
||||
|
done |
||||
|
mv -fv ${filesdir}/Maps/*.unr.uz ${compressedmapsdir} |
||||
} |
} |
||||
|
|
||||
fn_logmanager(){ |
fn_logmanager(){ |
||||
|
if [ ! -e ${consolelog} ];then |
||||
|
touch ${consolelog} |
||||
|
fi |
||||
# log manager will active if finds logs older than ${logdays} |
# log manager will active if finds logs older than ${logdays} |
||||
if [ `find ${scriptlogdir}/* -mtime +${logdays} |wc -l` -ne "0" ];then |
if [ `find ${scriptlogdir}/* -mtime +${logdays} |wc -l` -ne "0" ];then |
||||
echo -e "[\e[0;32m OK \e[0;39m] Starting log cleaner" |
echo -e "[\e[0;32m OK \e[0;39m] Starting log cleaner" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Starting log cleaner" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Starting log cleaner" >> ${scriptlog} |
||||
echo -e "[\e[0;36m INFO \e[0;39m] Removing logs older than ${logdays} days" |
echo -e "[\e[0;36m INFO \e[0;39m] Removing logs older than ${logdays} days" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Removing logs older than ${logdays} days" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Removing logs older than ${logdays} days" >> ${scriptlog} |
||||
find ${scriptlogdir}/* -mtime +${logdays} |tee >> ${scriptlog} |
find ${scriptlogdir}/* -mtime +${logdays} |tee >> ${scriptlog} |
||||
find ${consolelogdir}/* -mtime +${logdays} |tee >> ${scriptlog} |
find ${consolelogdir}/* -mtime +${logdays} |tee >> ${scriptlog} |
||||
scriptcount=`find ${scriptlogdir}/* -mtime +${logdays}|wc -l` |
scriptcount=$(find ${scriptlogdir}/* -mtime +${logdays}|wc -l) |
||||
consolecount=`find ${consolelogdir}/* -mtime +${logdays}|wc -l` |
consolecount=$(find ${consolelogdir}/* -mtime +${logdays}|wc -l) |
||||
count=$((${scriptcount} + ${consolecount})) |
count=$((${scriptcount} + ${consolecount})) |
||||
find ${scriptlogdir}/* -mtime +${logdays} -exec rm {} \; |
find ${scriptlogdir}/* -mtime +${logdays} -exec rm {} \; |
||||
find ${consolelogdir}/* -mtime +${logdays} -exec rm {} \; |
find ${consolelogdir}/* -mtime +${logdays} -exec rm {} \; |
||||
echo -e "[\e[0;36m INFO \e[0;39m] Log cleaner removed ${count} log files" |
echo -e "[\e[0;36m INFO \e[0;39m] Log cleaner removed ${count} log files" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Log cleaner removed ${count} log files" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Log cleaner removed ${count} log files" >> ${scriptlog} |
||||
fi |
fi |
||||
} |
} |
||||
|
|
||||
@ -141,10 +147,10 @@ esac |
|||||
done |
done |
||||
fn_stopserver |
fn_stopserver |
||||
echo -en "[ .... ] Starting ${servicename}: ${servername} debug mode" |
echo -en "[ .... ] Starting ${servicename}: ${servername} debug mode" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Starting ${servername} debug mode" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Starting ${servername} debug mode" >> ${scriptlog} |
||||
sleep 0.5 |
sleep 0.5 |
||||
echo -en "\r[\e[0;32m OK \e[0;39m] Starting ${servicename}: ${servername}" |
echo -en "\r[\e[0;32m OK \e[0;39m] Starting ${servicename}: ${servername}" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Started ${servername} debug mode" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Started ${servername} debug mode" >> ${scriptlog} |
||||
sleep 0.5 |
sleep 0.5 |
||||
echo -en "\n" |
echo -en "\n" |
||||
cd ${systemdir} |
cd ${systemdir} |
||||
@ -175,7 +181,7 @@ sleep 0.5 |
|||||
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) |
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep ${servicename}|wc -l) |
||||
if [ ${tmuxwc} -eq 1 ];then |
if [ ${tmuxwc} -eq 1 ];then |
||||
echo -e "\r[\e[0;32m OK \e[0;39m] Starting ${servicename} console" |
echo -e "\r[\e[0;32m OK \e[0;39m] Starting ${servicename} console" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} console accessed" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${servername} console accessed" >> ${scriptlog} |
||||
sleep 1 |
sleep 1 |
||||
tmux attach-session -t ${servicename} |
tmux attach-session -t ${servicename} |
||||
else |
else |
||||
@ -225,17 +231,17 @@ if [ ${tmuxwc} -eq 1 ];then |
|||||
done |
done |
||||
fi |
fi |
||||
echo -en "[ .... ] Starting ${servicename}: ${servername} backup" |
echo -en "[ .... ] Starting ${servicename}: ${servername} backup" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Starting ${servername} backup" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Starting ${servername} backup" >> ${scriptlog} |
||||
sleep 0.5 |
sleep 0.5 |
||||
echo -en "\r[\e[0;32m OK \e[0;39m] Starting ${servicename}: ${servername} backup" |
echo -en "\r[\e[0;32m OK \e[0;39m] Starting ${servicename}: ${servername} backup" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Started ${servername} backup" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Started ${servername} backup" >> ${scriptlog} |
||||
sleep 1 |
sleep 1 |
||||
echo -en "\n" |
echo -en "\n" |
||||
cd ${rootdir} |
cd ${rootdir} |
||||
mkdir ${backupdir} > /dev/null 2>&1 |
mkdir ${backupdir} > /dev/null 2>&1 |
||||
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude '${backupdir}' ${rootdir} |
tar -cvzf ${backupdir}/${backupname}.tar.gz --exclude '${backupdir}' ${rootdir} |
||||
echo -en "\r${servicename} backup complete" |
echo -en "\r${servicename} backup complete" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: backup complete" >> ${scriptlog} |
||||
} |
} |
||||
|
|
||||
fn_details(){ |
fn_details(){ |
||||
@ -300,7 +306,7 @@ if [ -f /etc/lsb-release ]; then |
|||||
elif [ -f /etc/debian_version ]; then |
elif [ -f /etc/debian_version ]; then |
||||
os="Debian $(cat /etc/debian_version)" |
os="Debian $(cat /etc/debian_version)" |
||||
elif [ -f /etc/redhat-release ]; then |
elif [ -f /etc/redhat-release ]; then |
||||
os=`cat /etc/redhat-release` |
os=$(cat /etc/redhat-release) |
||||
else |
else |
||||
os="$(uname -s) $(uname -r)" |
os="$(uname -s) $(uname -r)" |
||||
fi |
fi |
||||
@ -357,7 +363,7 @@ echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Sent email notification to ${ |
|||||
fn_emailtest(){ |
fn_emailtest(){ |
||||
fn_rootcheck |
fn_rootcheck |
||||
fn_syscheck |
fn_syscheck |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Emailing test notification" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Emailing test notification" >> ${scriptlog} |
||||
if [ "${emailnotification}" = "on" ];then |
if [ "${emailnotification}" = "on" ];then |
||||
subject="${servicename} Email Test Notification - Testing ${servername}" |
subject="${servicename} Email Test Notification - Testing ${servername}" |
||||
failurereason="Testing ${servicename} email notification" |
failurereason="Testing ${servicename} email notification" |
||||
@ -365,7 +371,7 @@ if [ "${emailnotification}" = "on" ];then |
|||||
fn_emailnotification |
fn_emailnotification |
||||
else |
else |
||||
echo -e "[\e[0;31m FAIL \e[0;39m] Email notification not enabled" |
echo -e "[\e[0;31m FAIL \e[0;39m] Email notification not enabled" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Email notification not enabled" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Email notification not enabled" >> ${scriptlog} |
||||
fi |
fi |
||||
sleep 0.5 |
sleep 0.5 |
||||
echo -en "\n" |
echo -en "\n" |
||||
@ -376,22 +382,22 @@ fn_serverquery(){ |
|||||
# detects if the server locks up |
# detects if the server locks up |
||||
if [ -f serverquery.py ];then |
if [ -f serverquery.py ];then |
||||
echo -e "[\e[0;36m INFO \e[0;39m] serverquery.py detected" |
echo -e "[\e[0;36m INFO \e[0;39m] serverquery.py detected" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: serverquery.py detected" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: serverquery.py detected" >> ${scriptlog} |
||||
echo -e "[\e[0;32m OK \e[0;39m] Querying ${servicename}: ${servername}: QUERYING" |
echo -e "[\e[0;32m OK \e[0;39m] Querying ${servicename}: ${servername}: QUERYING" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Querying ${servername}: QUERYING" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Querying ${servername}: QUERYING" >> ${scriptlog} |
||||
serverquery=`./serverquery.py 127.0.0.1 ${port} 2>&1` |
serverquery=$(./serverquery.py 127.0.0.1 ${port} 2>&1) |
||||
sleep 1 |
sleep 1 |
||||
if [ "${serverquery}" = "ERROR 1" ]||[ "${serverquery}" = "ERROR 2" ]||[ "${serverquery}" = "ERROR 3" ];then |
if [ "${serverquery}" = "ERROR 1" ]||[ "${serverquery}" = "ERROR 2" ]||[ "${serverquery}" = "ERROR 3" ];then |
||||
echo -e "[\e[0;31m FAIL \e[0;39m] Querying ${servicename}: ${servername}: ${serverquery}" |
echo -e "[\e[0;31m FAIL \e[0;39m] Querying ${servicename}: ${servername}: ${serverquery}" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Querying ${servername}: ${serverquery}" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Querying ${servername}: ${serverquery}" >> ${scriptlog} |
||||
sleep 1 |
sleep 1 |
||||
echo -e "[\e[1;33m WARN \e[0;39m] ${servicename}: Monitor detected ${servername} has locked up!" |
echo -e "[\e[1;33m WARN \e[0;39m] ${servicename}: Monitor detected ${servername} has locked up!" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Monitor detected ${servername} has locked up!" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Monitor detected ${servername} has locked up!" >> ${scriptlog} |
||||
sleep 1 |
sleep 1 |
||||
fn_restartserver |
fn_restartserver |
||||
else |
else |
||||
echo -e "[\e[0;32m OK \e[0;39m] Querying ${servicename}: ${servername}: ${serverquery}" |
echo -e "[\e[0;32m OK \e[0;39m] Querying ${servicename}: ${servername}: ${serverquery}" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Querying ${servername}: ${serverquery}" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Querying ${servername}: ${serverquery}" >> ${scriptlog} |
||||
sleep 1 |
sleep 1 |
||||
fi |
fi |
||||
fi |
fi |
||||
@ -402,13 +408,13 @@ fn_rootcheck |
|||||
fn_syscheck |
fn_syscheck |
||||
fn_logmanager |
fn_logmanager |
||||
echo -en "[ .... ] Monitor is checking ${servicename}: ${servername}" |
echo -en "[ .... ] Monitor is checking ${servicename}: ${servername}" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Monitor is checking ${servername}" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Monitor is checking ${servername}" >> ${scriptlog} |
||||
sleep 0.5 |
sleep 0.5 |
||||
updatecheck=`ps -ef|grep "${selfname} update"|grep -v grep|wc -l` |
updatecheck=$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l) |
||||
if [ "${updatecheck}" = "0" ];then |
if [ "${updatecheck}" = "0" ];then |
||||
fn_runcheck |
fn_runcheck |
||||
echo -en "\r[\e[1;33m WARN \e[0;39m] ${servicename}: Monitor detected ${servername} had stopped!\n" |
echo -en "\r[\e[1;33m WARN \e[0;39m] ${servicename}: Monitor detected ${servername} had stopped!\n" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Monitor detected ${servername} had stopped!" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Monitor detected ${servername} had stopped!" >> ${scriptlog} |
||||
if [ "${emailnotification}" = "on" ];then |
if [ "${emailnotification}" = "on" ];then |
||||
subject="${servicename} Monitor - Starting ${servername}" |
subject="${servicename} Monitor - Starting ${servername}" |
||||
failurereason="${servicename} process was not running" |
failurereason="${servicename} process was not running" |
||||
@ -417,18 +423,18 @@ if [ "${updatecheck}" = "0" ];then |
|||||
fi |
fi |
||||
sleep 0.5 |
sleep 0.5 |
||||
echo -en "\n" |
echo -en "\n" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Monitor is starting ${servername}" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Monitor is starting ${servername}" >> ${scriptlog} |
||||
fn_startserver |
fn_startserver |
||||
else |
else |
||||
echo -e "[\e[0;36m INFO \e[0;39m] ${servicename}: Monitor detected ${servername} is currently checking for updates!" |
echo -e "[\e[0;36m INFO \e[0;39m] ${servicename}: Monitor detected ${servername} is currently checking for updates!" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Monitor detected ${servername} is currently checking for updates!" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Monitor detected ${servername} is currently checking for updates!" >> ${scriptlog} |
||||
echo -e "[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} will start when updating is complete" |
echo -e "[\e[0;36m INFO \e[0;39m] ${servicename}: ${servername} will start when updating is complete" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} will start when updating is complete" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${servername} will start when updating is complete" >> ${scriptlog} |
||||
fi |
fi |
||||
} |
} |
||||
|
|
||||
fn_restartserver(){ |
fn_restartserver(){ |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Restarting ${servername}" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Restarting ${servername}" >> ${scriptlog} |
||||
fn_stopserver |
fn_stopserver |
||||
fn_startserver |
fn_startserver |
||||
} |
} |
||||
@ -438,15 +444,15 @@ fn_rootcheck |
|||||
fn_syscheck |
fn_syscheck |
||||
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) |
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) |
||||
echo -en "[ .... ] Stopping ${servicename}: ${servername}" |
echo -en "[ .... ] Stopping ${servicename}: ${servername}" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopping ${servername}" >> ${scriptlog} |
||||
sleep 0.5 |
sleep 0.5 |
||||
if [ "${pid}" == "0" ];then |
if [ "${pid}" == "0" ];then |
||||
echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" |
echo -en "\r[\e[0;31m FAIL \e[0;39m] Stopping ${servicename}: ${servername} is already stopped" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: ${servername} is already stopped" >> ${scriptlog} |
||||
else |
else |
||||
tmux kill-session -t ${servicename} |
tmux kill-session -t ${servicename} |
||||
echo -en "\r[\e[0;32m OK \e[0;39m] Stopping ${servicename}: ${servername}" |
echo -en "\r[\e[0;32m OK \e[0;39m] Stopping ${servicename}: ${servername}" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Stopped ${servername}" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Stopped ${servername}" >> ${scriptlog} |
||||
fi |
fi |
||||
sleep 0.5 |
sleep 0.5 |
||||
echo -en "\n" |
echo -en "\n" |
||||
@ -456,7 +462,7 @@ fn_startserver(){ |
|||||
fn_rootcheck |
fn_rootcheck |
||||
fn_syscheck |
fn_syscheck |
||||
echo -en "[ .... ] Starting ${servicename}: ${servername}" |
echo -en "[ .... ] Starting ${servicename}: ${servername}" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Starting ${servername}" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Starting ${servername}" >> ${scriptlog} |
||||
sleep 0.5 |
sleep 0.5 |
||||
fn_runcheck |
fn_runcheck |
||||
fn_logmanager |
fn_logmanager |
||||
@ -464,14 +470,14 @@ mv ${scriptlog} ${scriptlogdate} |
|||||
mv ${consolelog} ${consolelogdate} |
mv ${consolelog} ${consolelogdate} |
||||
cd ${systemdir} |
cd ${systemdir} |
||||
tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}" |
tmux new-session -d -s ${servicename} "./ucc-bin ${parms} |tee -a ${consolelog}" |
||||
tmuxwc=`tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l` |
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep ${servicename}|wc -l) |
||||
sleep 1 |
sleep 1 |
||||
if [ ${tmuxwc} -eq 0 ];then |
if [ ${tmuxwc} -eq 0 ];then |
||||
echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" |
echo -en "\r[\e[0;31m FAIL \e[0;39m] Starting ${servicename}: Failed to start ${servername}" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: failed to start ${servername}" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: failed to start ${servername}" >> ${scriptlog} |
||||
else |
else |
||||
echo -en "\r[\e[0;32m OK \e[0;39m] Starting ${servicename}: ${servername}" |
echo -en "\r[\e[0;32m OK \e[0;39m] Starting ${servicename}: ${servername}" |
||||
echo -e "$( date '+%b %d %H:%M:%S') ${servicename}: Started ${servername}" >> ${scriptlog} |
echo -e "$(date '+%b %d %H:%M:%S') ${servicename}: Started ${servername}" >> ${scriptlog} |
||||
fi |
fi |
||||
sleep 0.5 |
sleep 0.5 |
||||
echo -en "\n" |
echo -en "\n" |
||||
@ -507,7 +513,7 @@ fi |
|||||
echo "Running MD5 checksum to verify ut-server-436.tar.gz" |
echo "Running MD5 checksum to verify ut-server-436.tar.gz" |
||||
sleep 1 |
sleep 1 |
||||
echo "MD5 checksum: 10cd7353aa9d758a075c600a6dd193fd" |
echo "MD5 checksum: 10cd7353aa9d758a075c600a6dd193fd" |
||||
md5check=`md5sum ut-server-436.tar.gz| awk '{print $1;}'` |
md5check=$(md5sum ut-server-436.tar.gz| awk '{print $1;}') |
||||
echo "File returned: ${md5check}" |
echo "File returned: ${md5check}" |
||||
if [ "${md5check}" != "10cd7353aa9d758a075c600a6dd193fd" ];then |
if [ "${md5check}" != "10cd7353aa9d758a075c600a6dd193fd" ];then |
||||
echo "MD5 checksum: FAILED!" |
echo "MD5 checksum: FAILED!" |
||||
@ -528,7 +534,7 @@ fi |
|||||
echo "Running MD5 checksum to verify UTPGPatch451.tar.bz2" |
echo "Running MD5 checksum to verify UTPGPatch451.tar.bz2" |
||||
sleep 1 |
sleep 1 |
||||
echo "MD5 checksum: 77a735a78b1eb819042338859900b83b" |
echo "MD5 checksum: 77a735a78b1eb819042338859900b83b" |
||||
md5check=`md5sum UTPGPatch451.tar.bz2| awk '{print $1;}'` |
md5check=$(md5sum UTPGPatch451.tar.bz2| awk '{print $1;}') |
||||
echo "File returned: ${md5check}" |
echo "File returned: ${md5check}" |
||||
if [ "${md5check}" != "77a735a78b1eb819042338859900b83b" ];then |
if [ "${md5check}" != "77a735a78b1eb819042338859900b83b" ];then |
||||
echo "MD5 checksum: FAILED!" |
echo "MD5 checksum: FAILED!" |
||||
@ -580,7 +586,7 @@ while true; do |
|||||
[Yy]* ) break;; |
[Yy]* ) break;; |
||||
[Nn]* ) echo Exiting; return 1 ;; |
[Nn]* ) echo Exiting; return 1 ;; |
||||
* ) echo "Please answer yes or no.";; |
* ) echo "Please answer yes or no.";; |
||||
esac |
esac |
||||
done |
done |
||||
fn_header |
fn_header |
||||
fn_filesdl |
fn_filesdl |
||||
@ -697,4 +703,4 @@ case "$1" in |
|||||
echo "Usage: $0 {start|stop|restart|update|monitor|email-test|details|backup|console|debug|install|map-compressor|steam-auth}" |
echo "Usage: $0 {start|stop|restart|update|monitor|email-test|details|backup|console|debug|install|map-compressor|steam-auth}" |
||||
exit 1;; |
exit 1;; |
||||
esac |
esac |
||||
exit |
exit |
Loading…
Reference in new issue