fn_details 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # LGSM fn_details function
  3. # Author: Daniel Gibbs
  4. # Website: http://danielgibbs.co.uk
  5. # Version: 121114
  6. fn_autoip
  7. servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
  8. rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
  9. pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
  10. echo ""
  11. echo "${gamename} Server Details"
  12. echo "============================"
  13. echo "Server name: ${servername}"
  14. echo "Server IP: ${ip}:${port}"
  15. echo "RCON password: ${rcon}"
  16. echo "Config file: ${servercfgfullpath}"
  17. echo ""
  18. echo "${servername} Ports"
  19. echo "============================"
  20. echo "Ports the server is currently using."
  21. echo ""
  22. echo "DIRECTION DESCRIPTION PORT"
  23. echo "INBOUND Game/RCON port ${port}"
  24. if [ ! -z ${sourcetvport} ]; then
  25. echo "INBOUND SourceTV port ${sourcetvport}"
  26. fi
  27. echo "OUTBOUND Client port ${clientport}"
  28. echo ""
  29. echo "You can change ports by editing the"
  30. echo "start parameters in ${selfname}."
  31. echo ""
  32. if [ "${pid}" == "0" ]; then
  33. echo -e "Status:\e[0;31m OFFLINE\e[0;39m"
  34. else
  35. echo -e "Status:\e[0;32m ONLINE\e[0;39m"
  36. fi
  37. echo ""