fn_validate 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. # LGSM fn_validate function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. # Version: 280515
  6. # Description: Runs a server validation.
  7. local modulename="Validate"
  8. fn_validation(){
  9. fn_printwarn "Validating may overwrite some customised files."
  10. sleep 1
  11. echo -en "\n"
  12. echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
  13. sleep 5
  14. echo -en "\n"
  15. fn_printdots "Checking server files"
  16. sleep 1
  17. fn_printok "Checking server files"
  18. fn_scriptlog "Checking server files"
  19. sleep 1
  20. cd "${rootdir}"
  21. cd "steamcmd"
  22. fn_check_steamcmd
  23. fn_check_steamuser
  24. if [ $(command -v unbuffer) ]; then
  25. unbuffer=unbuffer
  26. fi
  27. ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
  28. if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
  29. echo -e '\n'
  30. fn_csgofix
  31. fi
  32. fn_scriptlog "Checking complete"
  33. }
  34. fn_check_root
  35. fn_check_systemdir
  36. tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
  37. if [ "${tmuxwc}" -eq 1 ]; then
  38. fn_stop
  39. fn_validation
  40. fn_start
  41. else
  42. fn_validation
  43. fi