From 94149361e6fe13653f445b6d1c9e9ef9775e5f22 Mon Sep 17 00:00:00 2001 From: UltimateByte Date: Tue, 5 Jan 2016 18:48:45 +0100 Subject: [PATCH] Added ts3_server_password --- functions/command_ts3_server_password.sh | 71 ++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 functions/command_ts3_server_password.sh diff --git a/functions/command_ts3_server_password.sh b/functions/command_ts3_server_password.sh new file mode 100644 index 000000000..7aee7b9f1 --- /dev/null +++ b/functions/command_ts3_server_password.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# LGSM command_serveradmin_password.sh function +# Author: Daniel Gibbs +# Contributor : UltimateByte +# Website: http://gameservermanagers.com +lgsm_version="030116" + +# Description: Changes TS3 serveradmin password + +local modulename="TS3 Server Password" +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" +while true; do + read -p "Continue ? [y/n]" yn + case $yn in + [Yy]* ) break;; + [Nn]* ) exit;; + * ) echo "Please answer yes or no.";; + esac +done + +fn_scriptlog "Initiating serveradmin password change" +echo -n "Enter the new password : " ; read newpassword +fn_scriptlog "New serveradmin password chosen" +} + + +fn_serveradmin_password_set(){ +fn_printdots "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 +sleep 1 +} + +# Running functions +check.sh +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