Browse Source

Updated function

pull/743/head
Daniel Gibbs 9 years ago
parent
commit
d99a7e2b43
  1. 2
      functions/command_monitor.sh
  2. 114
      functions/command_start.sh
  3. 2
      functions/core_messages.sh

2
functions/command_monitor.sh

@ -83,7 +83,7 @@ fn_monitor_tmux(){
done done
exit exit
else else
fn_print_fail "Checking session: FAIL" fn_print_fail "Checking session: "
fn_print_fail_eol_nl fn_print_fail_eol_nl
fn_scriptlog "Checking session: FAIL" fn_scriptlog "Checking session: FAIL"
fn_monitor_email_notification fn_monitor_email_notification

114
functions/command_start.sh

@ -10,69 +10,63 @@ local modulename="Starting"
function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
fn_start_teamspeak3(){ fn_start_teamspeak3(){
check.sh check.sh
info_ts3status.sh info_ts3status.sh
if [ "${ts3status}" != "Server is running" ]; then
# Will check for updates is updateonstart is yes
if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then
update_check.sh
fi
fi
if [ "${ts3status}" != "Server is running" ]; then if [ ! -e "${servercfgfullpath}" ]; then
# Will check for updates is updateonstart is yes fn_print_warn_nl "${servercfgfullpath} is missing"
if [ "${updateonstart}" == "yes" ]||[ "${updateonstart}" == "1" ]||[ "${updateonstart}" == "on" ]; then fn_scriptlog "${servercfgfullpath} is missing"
update_check.sh echo " * Creating blank ${servercfg}"
fi fn_scriptlog "Creating blank ${servercfg}"
fi sleep 2
echo " * ${servercfg} can remain blank by default."
fn_scriptlog "${servercfgfullpath} can remain blank by default."
sleep 2
echo " * ${servercfg} is located in ${servercfgfullpath}."
fn_scriptlog "${servercfg} is located in ${servercfgfullpath}."
sleep 5
touch "${servercfgfullpath}"
fi
if [ ! -e "${servercfgfullpath}" ]; then logs.sh
fn_print_warn "${servercfgfullpath} is missing"
fn_scriptlog "${servercfgfullpath} is missing"
sleep 2
echo -en "\n"
echo " * Creating blank ${servercfg}"
fn_scriptlog "Creating blank ${servercfg}"
sleep 2
echo " * ${servercfg} can remain blank by default."
fn_scriptlog "${servercfgfullpath} can remain blank by default."
sleep 2
echo " * ${servercfg} is located in ${servercfgfullpath}."
fn_scriptlog "${servercfg} is located in ${servercfgfullpath}."
sleep 5
touch "${servercfgfullpath}"
fi
logs.sh fn_print_dots "${servername}"
fn_scriptlog "${servername}"
sleep 1
fn_print_dots "${servername}" if [ "${ts3status}" == "Server is running" ]; then
fn_scriptlog "${servername}" fn_print_info_nl "${servername} is already running"
sleep 1 fn_scriptlog "${servername} is already running"
exit
fi
if [ "${ts3status}" == "Server is running" ]; then mv "${scriptlog}" "${scriptlogdate}"
fn_print_info "${servername} is already running" # Create lock file
fn_scriptlog "${servername} is already running" date > "${rootdir}/${lockselfname}"
cd "${executabledir}"
if [ "${ts3serverpass}" == "1" ];then
./ts3server_startscript.sh start serveradmin_password="${newpassword}"
else
./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1
fi
sleep 1 sleep 1
echo -en "\n" info_ts3status.sh
exit if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then
fi fn_print_fail_nl "Unable to start ${servername}"
fn_scriptlog "Unable to start ${servername}"
mv "${scriptlog}" "${scriptlogdate}" echo -e " Check log files: ${rootdir}/log"
# Create lock file exit 1
date > "${rootdir}/${lockselfname}" else
cd "${executabledir}" fn_print_ok_nl "${servername}"
if [ "${ts3serverpass}" == "1" ];then fn_scriptlog "Started ${servername}"
./ts3server_startscript.sh start serveradmin_password="${newpassword}" fi
else
./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1
fi
sleep 1
info_ts3status.sh
if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then
fn_print_fail_nl "Unable to start ${servername}"
fn_scriptlog "Unable to start ${servername}"
echo -e " Check log files: ${rootdir}/log"
exit 1
else
fn_print_ok "${servername}"
fn_scriptlog "Started ${servername}"
fi
sleep 0.5
echo -en "\n"
} }
fn_start_tmux(){ fn_start_tmux(){
@ -139,13 +133,11 @@ if [ "${tmuxwc}" -eq 0 ]; then
echo "" echo ""
echo "Command" echo "Command"
echo "=================================" echo "================================="
echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" | tee -a "${scriptlog}"
echo "tmux new-session -d -s \"${servicename}\" \"${executable} ${parms}\"" >> "${scriptlog}"
echo "" echo ""
echo "Error" echo "Error"
echo "=================================" echo "================================="
cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" | tee -a "${scriptlog}"
cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" >> "${scriptlog}"
# Detected error http://gameservermanagers.com/issues # Detected error http://gameservermanagers.com/issues
if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ]; then if [ $(grep -c "Operation not permitted" "${scriptlogdir}/.${servicename}-tmux-error.tmp") ]; then

2
functions/core_messages.sh

@ -140,7 +140,7 @@ fn_print_error_nl(){
echo -e "\e[0;31mError!\e[0m $@" echo -e "\e[0;31mError!\e[0m $@"
} }
# Info! # Infomation!
fn_print_infomation(){ fn_print_infomation(){
echo -en "\e[0;36mInfomation!\e[0m $@" echo -en "\e[0;36mInfomation!\e[0m $@"
} }

Loading…
Cancel
Save