source: scripts/usr/local/lib/7dtd/commands/instances.sh@ 18

Last change on this file since 18 was 17, checked in by alloc, 11 years ago

Version 4

File size: 848 bytes
Line 
1#!/bin/bash
2# Version 4
3
4
5sdtdCommandInstances() {
6 printf "%-*s | %-*s | %-*s | %-*s\n" 20 "Instance name" 8 "Running" 7 "Players" 5 "Port"
7 printf -v line "%*s-+-%*s-+-%*s-+-%*s\n" 20 " " 8 " " 7 " " 5 " "
8 echo ${line// /-}
9 for I in $(getInstanceList); do
10 if [ $(isRunning $I) -eq 1 ]; then
11 run="yes"
12 tel=$(telnetCommand $I lp)
13 cur=`echo $tel | sed "s/\r/\n/g" | sed "s/^ //g" | grep "Total of " | cut -d\ -f 3`
14 else
15 run="no"
16 cur="-"
17 fi
18
19 max=$(getConfigValue $I ServerMaxPlayerCount)
20 port=$(getConfigValue $I ServerPort)
21
22 printf "%-*s | %*s | %2s/%2d | %5d\n" 20 "$I" 8 "$run" $cur $max $port
23 done
24 exit 0
25}
26
27sdtdCommandInstancesHelp() {
28 echo "Usage: $(basename $0) instances"
29 echo
30 echo "List all defined instances and their status."
31}
32
33sdtdCommandInstancesDescription() {
34 echo "List all defined instances"
35}
Note: See TracBrowser for help on using the repository browser.