From 63589ee53e27c28dccb0667543492e2f0073b7ee Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 7 Jan 2016 22:11:49 +0000 Subject: [PATCH] Streamlined the command * Streamlined the command to use command_start * made interface mor like command_console and command_backup --- functions/command_start.sh | 8 +++- functions/command_ts3_server_pass.sh | 58 ++++++++++++---------------- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/functions/command_start.sh b/functions/command_start.sh index a79302698..d71b99e5a 100644 --- a/functions/command_start.sh +++ b/functions/command_start.sh @@ -2,7 +2,7 @@ # LGSM command_start.sh function # Author: Daniel Gibbs # Website: http://gameservermanagers.com -lgsm_version="271215" +lgsm_version="070116" # Description: Starts the server. @@ -55,7 +55,11 @@ mv "${scriptlog}" "${scriptlogdate}" # Create lock file date > "${rootdir}/${lockselfname}" cd "${executabledir}" -./ts3server_startscript.sh start inifile="${servercfgfullpath}" > /dev/null 2>&1 +if [ "${ts2serverpass}" == "1" ];then + ./ts3server_startscript.sh start serveradmin_password="${newpassword}" +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 diff --git a/functions/command_ts3_server_pass.sh b/functions/command_ts3_server_pass.sh index bb3803015..e5f980832 100644 --- a/functions/command_ts3_server_pass.sh +++ b/functions/command_ts3_server_pass.sh @@ -3,7 +3,7 @@ # Author: Daniel Gibbs # Contributor : UltimateByte # Website: http://gameservermanagers.com -lgsm_version="050116" +lgsm_version="070116" # Description: Changes TS3 serveradmin password @@ -12,43 +12,39 @@ function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" fn_serveradmin_password_prompt(){ -fn_printwarn "Initiating TS3 serveradmin password change" -sleep 2 -echo -en "\n" -echo "Changing telnet ServerQuery password" +echo "" +echo "${gamename} ServerAdmin Password Change" +echo "============================" +echo "" +echo "Press \"CTRL+b d\" to exit console." +fn_printwarningnl "You are about to change the ${gamename} ServerAdmin password" +echo "" while true; do - read -p "Continue ? [y/n]" yn + read -e -i "y" -p "Continue? [y/N]" yn case $yn in [Yy]* ) break;; - [Nn]* ) exit;; + [Nn]* ) echo Exiting; return;; * ) echo "Please answer yes or no.";; - esac +esac done - -fn_scriptlog "Initiating serveradmin password change" -echo -n "Enter the new password : " ; read newpassword -fn_scriptlog "New serveradmin password chosen" +fn_scriptlog "Initiating ${gamename} ServerAdmin password change" +read -p "Enter new password : " newpassword } fn_serveradmin_password_set(){ -fn_printdots "Applying new password" +fn_printinfo "Applying new password" +fn_scriptlog "Applying new password" sleep 1 -fn_scriptlog "Starting routine with new password start option" - -./ts3server_startscript.sh start serveradmin_password="${newpassword}" > /dev/null 2>&1 - -info_ts3status.sh -if [ "${ts3status}" = "Server seems to have died" ]||[ "${ts3status}" = "No server running (ts3server.pid is missing)" ]; then - fn_printfailnl "Unable to start ${servername}" - fn_scriptlog "Unable to start ${servername}" - echo -e " Check log files: ${rootdir}/log" - exit 1 -else - fn_printok "${servername} has set a new serveradmin password" - echo -en "\n" - fn_scriptlog "Started ${servername} with new password" -fi +# Stop any running server +command_stop.sh +# Start server in "new password mode" +ts3serverpass="1" +command_start.sh +# Stop server in "new password mode" +command_stop.sh +fn_printok "Applying new password" +fn_scriptlog "New ServerAdmin password has been applyed" sleep 1 } @@ -58,14 +54,8 @@ fn_serveradmin_password_prompt info_ts3status.sh if [ "${ts3status}" == "Server is running" ]; then - command_stop.sh fn_serveradmin_password_set - echo "Server will now restart normally" - sleep 1 - command_stop.sh command_start.sh else fn_serveradmin_password_set - echo -en "\n" - command_stop.sh fi \ No newline at end of file