fn_validate 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. # LGSM fn_validate function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. # Version: 040715
  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. if [ "${engine}" == "goldsource" ]; then
  28. ${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}"
  29. else
  30. ${unbuffer} ./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
  31. fi
  32. if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
  33. echo -e '\n'
  34. fn_csgofix
  35. fi
  36. fn_scriptlog "Checking complete"
  37. }
  38. fn_check_root
  39. fn_check_systemdir
  40. tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
  41. if [ "${tmuxwc}" -eq 1 ]; then
  42. fn_stop
  43. fn_validation
  44. fn_start
  45. else
  46. fn_validation
  47. fi