command_ts3_server_pass.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # LinuxGSM command_ts3_server_pass.sh function
  3. # Author: Daniel Gibbs
  4. # Contributor : UltimateByte
  5. # Website: https://linuxgsm.com
  6. # Description: Changes TS3 serveradmin password.
  7. local commandname="PASSWORD-CHANGE"
  8. local commandaction="Password Change"
  9. local function_selfname=$(basename "$(readlink -f "${BASH_SOURCE[0]}")")
  10. fn_serveradmin_password_prompt(){
  11. fn_print_header
  12. fn_print_information_nl "You are about to change the ${gamename} ServerAdmin password."
  13. fn_print_warning_nl "${gamename} will restart during this process."
  14. echo -e ""
  15. if ! fn_prompt_yn "Continue?" Y; then
  16. echo Exiting; exit
  17. fi
  18. fn_script_log_info "Initiating ${gamename} ServerAdmin password change"
  19. read -rp "Enter new password: " newpassword
  20. fn_print_info_nl "Changing password"
  21. fn_script_log_info "Changing password"
  22. }
  23. fn_serveradmin_password_set(){
  24. # Start server in "new password mode".
  25. ts3serverpass="1"
  26. exitbypass="1"
  27. command_start.sh
  28. fn_print_ok_nl "New password applied"
  29. fn_script_log_pass "New ServerAdmin password applied"
  30. }
  31. # Running functions.
  32. check.sh
  33. fn_serveradmin_password_prompt
  34. if [ "${status}" != "0" ]; then
  35. # Stop any running server.
  36. exitbypass="1"
  37. command_stop.sh
  38. fn_serveradmin_password_set
  39. parms="serveradmin_password=\"${newpassword}\" inifile=\"${servercfgfullpath}\" > /dev/null 2>&1"
  40. ts3serverpass="0"
  41. command_restart.sh
  42. else
  43. fn_serveradmin_password_set
  44. command_stop.sh
  45. fi
  46. core_exit.sh