From fc92831dcf448716f0c8a3885134ae4ca72f4c72 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Wed, 14 Sep 2022 06:50:22 -0600 Subject: [PATCH] deploy: add restart indicator to status --- check-restart | 36 ------------------------------------ deploy | 7 ++++++- 2 files changed, 6 insertions(+), 37 deletions(-) delete mode 100755 check-restart diff --git a/check-restart b/check-restart deleted file mode 100755 index 276d388..0000000 --- a/check-restart +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env sh - -. ./common.sh - -while getopts "r" arg; do - case $arg in - r) - REBOOT=1 - ;; - esac -done - -start - -for i in $(ls hosts); do - host=$(resolveAlias $i) - echo -n "===> $i: " - if tsAlive $host; then - if ${SSH} root@$host 'check-restart' >/dev/null 2>&1; then - echo -e "\tOK" - else - if [ ! -z $REBOOT ]; then - if isRunHost $i; then - echo -e "\tskipping runhost..." - else - echo -e "\trebooting..." - ${SSH} root@$host 'reboot' >/dev/null 2>&1 - fi - else - echo -e "\tREBOOT" - fi - fi - else - echo -e "\tDOWN" - fi -done diff --git a/deploy b/deploy index bfe6f13..16f27f9 100755 --- a/deploy +++ b/deploy @@ -52,7 +52,12 @@ if [ "$1" = "status" ]; then rev_status="×" fi fi - echo -e "\t\t${remote_ver}\t${rev_status}\t(${rev_msg})" + echo -en "\t\t${remote_ver}\t${rev_status}\t(${rev_msg})" + if ${SSH} root@$host 'check-restart' >/dev/null 2>&1; then + echo -e "\tOK" + else + echo -e "\tREBOOT" + fi done exit 0 fi