check_status.sh 663 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. # LGSM check_status function
  3. # Author: Daniel Gibbs
  4. # Website: https://gameservermanagers.com
  5. lgsm_version="060516"
  6. # Description: Checks the proccess status of the server. Either online or offline.
  7. if [ "${gamename}" == "Teamspeak 3" ]; then
  8. # 1: Server is running
  9. # 0: Server seems to have died
  10. # 0: No server running (ts3server.pid is missing)
  11. status=$(${executabledir}/ts3server_startscript.sh status servercfgfullpathfile=${servercfgfullpath})
  12. if [ "${status}" == "Server is running" ]; then
  13. status=1
  14. else
  15. ts3error="${status}"
  16. status=0
  17. fi
  18. else
  19. status=$(tmux list-sessions 2>&1 | awk '{print $1}' | grep -Ec "^${servicename}:")
  20. fi