better status output

This commit is contained in:
Thomas von Dein
2021-07-05 14:35:24 +02:00
parent 3a3dce8903
commit 938fc3a38b

26
jaildk
View File

@@ -1248,17 +1248,25 @@ Show status of <jail>. Without <jail>, show status of all jails."
jaildk_jail() { jaildk_jail() {
local jail mode jid ip path runs build base _eip ip4addr osrelease path build # reversed argument order here so that $jail is optional, in which
# FIXME: reversed argument order for historical reasons, maybe change this? # case the command works on all jails
local jail mode jid ip path runs build base _eip ip4addr osrelease path build lookup
mode=$1 mode=$1
jail=$2 jail=$2
if test -z "$jail" -a $mode = "status"; then if test -a $mode = "status"; then
bold "Running jails:" bold "Running jail[s]:"
( (
if test -z "$jail"; then
lookup='*'
else
lookup=$jail
fi
echo "Jail IP-Address Path Is-Running RW-mounted Current-Version Base" echo "Jail IP-Address Path Is-Running RW-mounted Current-Version Base"
grep -h "name=" $j/etc/*/jail.conf | cut -d= -f2 | while read jail; do grep -h "name=" $j/etc/$lookup/jail.conf | cut -d= -f2 | while read jail; do
jid='' jid=''
ip='' ip=''
path='' path=''
@@ -1309,15 +1317,15 @@ jaildk_jail() {
echo "$jail $ip $path $jid $build $version $osrelease" echo "$jail $ip $path $jid $build $version $osrelease"
done done
) | column -t ) | column -t
if test -n "$jail"; then
jaildk_rc $jail status
fi
elif test -z "$jail"; then elif test -z "$jail"; then
usage_$mode usage_$mode
else else
bold "Jail $jail $mode:" bold "Jail $jail $mode:"
case $mode in case $mode in
status)
service jail $mode $jail | egrep "IP|$jail"
jaildk_rc $jail status
;;
*) *)
service jail $mode $jail service jail $mode $jail
jaildk_ipfw $jail $mode jaildk_ipfw $jail $mode