command_validate.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. # LGSM command_validate.sh function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. lgsm_version="271215"
  6. # Description: Runs a server validation.
  7. local modulename="Validate"
  8. function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  9. fn_validation(){
  10. fn_printwarn "Validating may overwrite some customised files."
  11. sleep 1
  12. echo -en "\n"
  13. echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
  14. sleep 5
  15. echo -en "\n"
  16. fn_printdots "Checking server files"
  17. sleep 1
  18. fn_printok "Checking server files"
  19. fn_scriptlog "Checking server files"
  20. sleep 1
  21. cd "${rootdir}/steamcmd"
  22. if [ $(command -v unbuffer) ]; then
  23. unbuffer=unbuffer
  24. fi
  25. if [ "${engine}" == "goldsource" ]; then
  26. ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_set_config 90 mod ${appidmod} +app_update "${appid}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
  27. else
  28. ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
  29. fi
  30. fix.sh
  31. fn_scriptlog "Checking complete"
  32. }
  33. check.sh
  34. tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
  35. if [ "${tmuxwc}" -eq 1 ]; then
  36. command_stop.sh
  37. fn_validation
  38. command_start.sh
  39. else
  40. fn_validation
  41. fi