command_ts3_server_pass.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_printinfonl "You are about to change the ${gamename} ServerAdmin password"
  17. fn_printwarningnl "${gamename} will restart during this process"
  18. echo ""
  19. while true; do
  20. read -e -i "y" -p "Continue? [y/N]" yn
  21. case $yn in
  22. [Yy]* ) break;;
  23. [Nn]* ) echo Exiting; return;;
  24. * ) echo "Please answer yes or no.";;
  25. esac
  26. done
  27. fn_scriptlog "Initiating ${gamename} ServerAdmin password change"
  28. read -p "Enter new password : " newpassword
  29. }
  30. fn_serveradmin_password_set(){
  31. fn_printinfo "Applying new password"
  32. fn_scriptlog "Applying new password"
  33. sleep 1
  34. # Stop any running server
  35. command_stop.sh
  36. # Start server in "new password mode"
  37. ts3serverpass="1"
  38. command_start.sh
  39. # Stop server in "new password mode"
  40. command_stop.sh
  41. fn_printok "Applying new password"
  42. fn_scriptlog "New ServerAdmin password has been applyed"
  43. sleep 1
  44. }
  45. # Running functions
  46. check.sh
  47. fn_serveradmin_password_prompt
  48. info_ts3status.sh
  49. if [ "${ts3status}" == "Server is running" ]; then
  50. fn_serveradmin_password_set
  51. command_start.sh
  52. else
  53. fn_serveradmin_password_set
  54. fi