Line | |
---|
1 | #!/bin/bash
|
---|
2 | # Version 4
|
---|
3 |
|
---|
4 |
|
---|
5 | sdtdCommandInstances() {
|
---|
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 |
|
---|
27 | sdtdCommandInstancesHelp() {
|
---|
28 | echo "Usage: $(basename $0) instances"
|
---|
29 | echo
|
---|
30 | echo "List all defined instances and their status."
|
---|
31 | }
|
---|
32 |
|
---|
33 | sdtdCommandInstancesDescription() {
|
---|
34 | echo "List all defined instances"
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.