sort by seconds
This commit is contained in:
@@ -1,26 +1,22 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
############################################################################ begin logging
|
||||
# check if stdout is a terminal...
|
||||
if test -t 1; then
|
||||
# see if it supports colors...
|
||||
ncolors=$(tput colors)
|
||||
|
||||
# see if it supports colors...
|
||||
ncolors=$(tput colors)
|
||||
|
||||
if test -n "$ncolors" && test $ncolors -ge 8; then
|
||||
bold="$(tput bold)"
|
||||
underline="$(tput smul)"
|
||||
standout="$(tput smso)"
|
||||
normal="$(tput sgr0)"
|
||||
black="$(tput setaf 0)"
|
||||
red="$(tput setaf 1)"
|
||||
green="$(tput setaf 2)"
|
||||
yellow="$(tput setaf 3)"
|
||||
blue="$(tput setaf 4)"
|
||||
magenta="$(tput setaf 5)"
|
||||
cyan="$(tput setaf 6)"
|
||||
white="$(tput setaf 7)"
|
||||
fi
|
||||
if test -n "$ncolors" && test $ncolors -ge 8; then
|
||||
bold="$(tput bold)"
|
||||
underline="$(tput smul)"
|
||||
standout="$(tput smso)"
|
||||
normal="$(tput sgr0)"
|
||||
black="$(tput setaf 0)"
|
||||
red="$(tput setaf 1)"
|
||||
green="$(tput setaf 2)"
|
||||
yellow="$(tput setaf 3)"
|
||||
blue="$(tput setaf 4)"
|
||||
magenta="$(tput setaf 5)"
|
||||
cyan="$(tput setaf 6)"
|
||||
white="$(tput setaf 7)"
|
||||
fi
|
||||
|
||||
append_msg() {
|
||||
@@ -171,7 +167,7 @@ services=$(for stack in ${stacks}; do
|
||||
"
|
||||
for service in ${status}; do
|
||||
time=${service%%;*}
|
||||
echo "$(date -d "$(sed 's,about an* ,1 ,' <<<${time})");${service#*;}"
|
||||
echo "$(date +%s -d "$(sed 's,about an* ,1 ,' <<<${time})");${service#*;}"
|
||||
done
|
||||
done | sort -hr)
|
||||
|
||||
@@ -184,6 +180,6 @@ for service in ${services}; do
|
||||
$5 !~ /^Running/ {printf "'"${red}"'%-15s%-40s%s %s%s\n", $3, $2, $5, $7, "'"${normal}"'"}
|
||||
$5 ~ /^Running/ && doshort==0 {printf "%s%-15s%-40s%s%s\n", color, $3, $2, $5, "'"${normal}"'"}
|
||||
dolog==1 && (doshort==0 || $5 !~ /^Running/) {printf "ssh %s docker logs -f %s.%s\n", $3, $2, $6}
|
||||
doexec==1 && (dohort==0 || $5 !~ /^Running/) {printf "ssh %s docker exec -it %s.%s bash\n", $3, $2, $6}
|
||||
doexec==1 && (dohort==0 || $5 !~ /^Running/) {printf "ssh -t %s docker exec -it %s.%s bash\n", $3, $2, $6}
|
||||
' <<<${service}
|
||||
done
|
||||
|
Reference in New Issue
Block a user