command_validate.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. check_update_lock.sh
  31. fn_print_dots "SteamCMD"
  32. if [ "${status}" != "0" ]; then
  33. fn_print_restart_warning
  34. exitbypass=1
  35. command_stop.sh
  36. fn_firstcommand_reset
  37. fn_validate
  38. exitbypass=1
  39. command_start.sh
  40. fn_firstcommand_reset
  41. else
  42. fn_validate
  43. fi
  44. # remove update lockfile
  45. rm -f "${lockdir:?}/update.lock"
  46. core_exit.sh