source: scripts/usr/local/bin/7dtd-instances.sh @ 11

Last change on this file since 11 was 11, checked in by alloc, 9 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
9checkRootLoadConf
10
11printf "%-*s | %-*s | %-*s\n" 20 "Instance name" 8 "Running" 7 "Players"
12printf -v line "%*s-+-%*s-+-%*s\n" 20 " " 8 " " 7 " "
13echo ${line// /-}
14for 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
29done
30exit 0
Note: See TracBrowser for help on using the repository browser.