command_ts3_server_pass.sh 1.6 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="080116"
  7. # Description: Changes TS3 serveradmin password
  8. local modulename="Change 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_print_infomation_nl "You are about to change the ${gamename} ServerAdmin password."
  17. fn_print_warning_nl "${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_print_info_nl "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. fn_print_info_nl "Starting server with new password"
  39. command_start.sh
  40. # Stop server in "new password mode"
  41. command_stop.sh
  42. fn_print_ok_nl "Password applied"
  43. fn_scriptlog "New ServerAdmin password applied"
  44. sleep 1
  45. }
  46. # Running functions
  47. check.sh
  48. fn_serveradmin_password_prompt
  49. info_ts3status.sh
  50. if [ "${ts3status}" == "Server is running" ]; then
  51. fn_serveradmin_password_set
  52. command_start.sh
  53. else
  54. fn_serveradmin_password_set
  55. fi