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