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