From 19ec331f1a866509251dc8246d426aab865477e9 Mon Sep 17 00:00:00 2001 From: Khue Doan Date: Thu, 12 Nov 2020 22:50:27 +0700 Subject: [PATCH] Move reset script to Python --- infra/scripts/reset.py | 17 +++++++++++++++++ infra/scripts/shutdown.sh | 6 ------ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100755 infra/scripts/reset.py delete mode 100755 infra/scripts/shutdown.sh diff --git a/infra/scripts/reset.py b/infra/scripts/reset.py new file mode 100755 index 00000000..004f9afc --- /dev/null +++ b/infra/scripts/reset.py @@ -0,0 +1,17 @@ +#!/bin/python + +import os + +user = "root" + +nodes = [ + "node0.homelab.local", + "node1.homelab.local", + "node2.homelab.local", + "node3.homelab.local" +] + + +for node in nodes: + print(f"ssh {user}@{node} poweroff") + os.system(f"ssh {user}@{node} poweroff") diff --git a/infra/scripts/shutdown.sh b/infra/scripts/shutdown.sh deleted file mode 100755 index b7cb1a72..00000000 --- a/infra/scripts/shutdown.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -ssh root@node0.homelab.local 'efibootmgr --bootnext 0006 && poweroff' -ssh root@node1.homelab.local 'efibootmgr --bootnext 0006 && poweroff' -ssh root@node2.homelab.local 'efibootmgr --bootnext 0006 && poweroff' -ssh root@node3.homelab.local 'efibootmgr --bootnext 0006 && poweroff'