command_validate.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # LinuxGSM command_validate.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: https://linuxgsm.com/contrib
  5. # Website: https://linuxgsm.com
  6. # Description: Runs a server validation.
  7. commandname="VALIDATE"
  8. commandaction="Validating"
  9. moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  10. fn_firstcommand_set
  11. fn_validate() {
  12. fn_print_warn ": SteamCMD: Validate might overwrite some customised files"
  13. fn_script_log_warn "${commandaction} server: Validate might overwrite some customised files"
  14. totalseconds=3
  15. for seconds in {3..1}; do
  16. fn_print_warn ": SteamCMD: Validate might overwrite some customised files: ${totalseconds}"
  17. totalseconds=$((totalseconds - 1))
  18. fn_sleep_time_1
  19. if [ "${seconds}" == "0" ]; then
  20. break
  21. fi
  22. done
  23. fn_print_warn_nl ": SteamCMD: Validate might overwrite some customised files"
  24. date '+%s' > "${lockdir:?}/update.lock"
  25. fn_dl_steamcmd
  26. }
  27. fn_print_dots ""
  28. check.sh
  29. core_logs.sh
  30. fn_print_dots "SteamCMD"
  31. if [ "${status}" != "0" ]; then
  32. fn_print_restart_warning
  33. exitbypass=1
  34. command_stop.sh
  35. fn_firstcommand_reset
  36. fn_validate
  37. exitbypass=1
  38. command_start.sh
  39. fn_firstcommand_reset
  40. else
  41. fn_validate
  42. fi
  43. # remove update lockfile
  44. rm -f "${lockdir:?}/update.lock"
  45. core_exit.sh