|
|
|
@ -125,6 +125,7 @@ trap 'traperror "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FU |
|
|
|
|
|
|
|
|
|
######################################################### commandline parameter evaluation |
|
|
|
|
exec=0 |
|
|
|
|
stop=0 |
|
|
|
|
log=0 |
|
|
|
|
stacks= |
|
|
|
|
short=0 |
|
|
|
@ -140,6 +141,7 @@ OPTIONS |
|
|
|
|
--help, -h show this help |
|
|
|
|
--log, -l show log command |
|
|
|
|
--exec, -e show exec command |
|
|
|
|
--stop, -x show stop command |
|
|
|
|
--short, -s only show errors |
|
|
|
|
|
|
|
|
|
stacks optional space separated list of stacks |
|
|
|
@ -152,6 +154,7 @@ EOF |
|
|
|
|
exit;; |
|
|
|
|
(--log|-l) log=1;; |
|
|
|
|
(--exec|-e) exec=1;; |
|
|
|
|
(--stop|-x) stop=1;; |
|
|
|
|
(--short|-s) short=1;; |
|
|
|
|
(*) stacks="$*"; break;; |
|
|
|
|
esac |
|
|
|
@ -171,19 +174,20 @@ 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 -d "$(sed 's,about an* ,1 ,;s,less than an* ,0 ,' <<<${time})");${service#*;}" |
|
|
|
|
done |
|
|
|
|
done | sort -hr) |
|
|
|
|
|
|
|
|
|
IFS=" |
|
|
|
|
" |
|
|
|
|
for service in ${services}; do |
|
|
|
|
awk -F';' -v dolog=$log -v doexec=$exec -v doshort=$short ' |
|
|
|
|
awk -F';' -v dolog=$log -v doexec=$exec -v dostop=$stop -v doshort=$short ' |
|
|
|
|
{color="'"${green}"'"} |
|
|
|
|
$5 ~ /second|minute/ {color="'"${yellow}"'"} |
|
|
|
|
$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} |
|
|
|
|
dostop==1 && (dohort==0 || $5 !~ /^Running/) {printf "ssh %s docker stop %s.%s\n", $3, $2, $6} |
|
|
|
|
' <<<${service} |
|
|
|
|
done |
|
|
|
|