From 7204b8d66e11fdae0f8340080cd91a1e5abafc27 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 29 Nov 2024 15:24:26 -0500 Subject: [PATCH] add reboot script --- reboot | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 reboot diff --git a/reboot b/reboot new file mode 100755 index 0000000..c326f70 --- /dev/null +++ b/reboot @@ -0,0 +1,27 @@ +#!/bin/bash + +set -o errexit -o nounset -o pipefail + +[[ $# -eq 2 ]] || exit 1 + +input= +read -p "Reboot $1 servers? " input +if [[ $input != yes ]]; then + exit 1 +fi +echo + +user=root + +. hosts.sh + +declare -n hosts=hosts_$1 +for host in ${hosts[@]}; do + echo $host + echo + + systemctl -H $host reboot + sleep $2 + + echo +done