From 14b334ff55cba4f8bdba56e4511287f03e48b2ef Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 3 Nov 2022 00:59:59 -0700 Subject: [PATCH] new script: `sane-reboot`, to prevent me from rebooting the wrong machine when working with multiple hosts --- pkgs/sane-scripts/default.nix | 1 + pkgs/sane-scripts/src/sane-reboot | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100755 pkgs/sane-scripts/src/sane-reboot diff --git a/pkgs/sane-scripts/default.nix b/pkgs/sane-scripts/default.nix index 510458ad..3f392a0f 100644 --- a/pkgs/sane-scripts/default.nix +++ b/pkgs/sane-scripts/default.nix @@ -25,6 +25,7 @@ resholve.mkDerivation { gnugrep gocryptfs ifuse + inetutils inotify-tools ncurses oath-toolkit diff --git a/pkgs/sane-scripts/src/sane-reboot b/pkgs/sane-scripts/src/sane-reboot new file mode 100755 index 00000000..21c03387 --- /dev/null +++ b/pkgs/sane-scripts/src/sane-reboot @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +target="$1" +host="$(hostname)" +if [ "$host" = "$target" ] +then + sudo reboot now +else + echo "WRONG MACHINE. you're on $host." + exit 1 +fi +