command_validate.sh 1.4 KB

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