Last change
on this file since 10 was
10,
checked in by alloc, 9 years ago
|
Version 1
|
-
Property svn:executable set to
*
|
File size:
651 bytes
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | # Version 1 |
---|
3 | |
---|
4 | # Lists available 7dtd instances. |
---|
5 | # Returns: |
---|
6 | # 0 |
---|
7 | . /usr/local/bin/7dtd-common.sh |
---|
8 | checkRootLoadConf |
---|
9 | |
---|
10 | printf "%-*s | %-*s | %-*s\n" 20 "Instance name" 8 "Running" 7 "Players" |
---|
11 | printf -v line "%*s-+-%*s-+-%*s\n" 20 " " 8 " " 7 " " |
---|
12 | echo ${line// /-} |
---|
13 | for I in $SDTD_BASE/instances/*; do |
---|
14 | ins=`basename $I` |
---|
15 | run=$(isRunning $ins) |
---|
16 | if [ $run -eq 1 ]; then |
---|
17 | run="yes" |
---|
18 | else |
---|
19 | run="no" |
---|
20 | fi |
---|
21 | |
---|
22 | tel=$(telnetCommand $ins lp) |
---|
23 | max=$(getConfigValue $ins ServerMaxPlayerCount) |
---|
24 | cur=`echo $tel | sed "s/\r/\n/g" | sed "s/^ //g" | grep "Total of " | cut -d\ -f 3` |
---|
25 | |
---|
26 | printf "%-*s | %*s | %2d/%2d\n" 20 "$ins" 8 "$run" $cur $max |
---|
27 | done |
---|
28 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.