command_ts3_server_pass.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. # LGSM command_serveradmin_password.sh function
  3. # Author: Daniel Gibbs
  4. # Contributor : UltimateByte
  5. # Website: http://gameservermanagers.com
  6. lgsm_version="070116"
  7. # Description: Changes TS3 serveradmin password
  8. local modulename="TS3 Server Password"
  9. function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  10. fn_serveradmin_password_prompt(){
  11. echo ""
  12. echo "${gamename} ServerAdmin Password Change"
  13. echo "============================"
  14. echo ""
  15. echo "Press \"CTRL+b d\" to exit console."
  16. fn_printwarningnl "You are about to change the ${gamename} ServerAdmin password"
  17. echo ""
  18. while true; do
  19. read -e -i "y" -p "Continue? [y/N]" yn
  20. case $yn in
  21. [Yy]* ) break;;
  22. [Nn]* ) echo Exiting; return;;
  23. * ) echo "Please answer yes or no.";;
  24. esac
  25. done
  26. fn_scriptlog "Initiating ${gamename} ServerAdmin password change"
  27. read -p "Enter new password : " newpassword
  28. }
  29. fn_serveradmin_password_set(){
  30. fn_printinfo "Applying new password"
  31. fn_scriptlog "Applying new password"
  32. sleep 1
  33. # Stop any running server
  34. command_stop.sh
  35. # Start server in "new password mode"
  36. ts3serverpass="1"
  37. command_start.sh
  38. # Stop server in "new password mode"
  39. command_stop.sh
  40. fn_printok "Applying new password"
  41. fn_scriptlog "New ServerAdmin password has been applyed"
  42. sleep 1
  43. }
  44. # Running functions
  45. check.sh
  46. fn_serveradmin_password_prompt
  47. info_ts3status.sh
  48. if [ "${ts3status}" == "Server is running" ]; then
  49. fn_serveradmin_password_set
  50. command_start.sh
  51. else
  52. fn_serveradmin_password_set
  53. fi