#!/usr/bin/env nix-shell #!nix-shell -i bash -p bash -p nettools -p systemd target="$1" shift host="$(hostname)" if [ "$host" = "$target" ] then # N.B.: anything other than just `reboot` with no args requires `sudo` privileges (to write to /run/systemd/). # `systemctl reboot -i` tells systemd to ignore inhibitors (i.e. other users logged in). reboot "$@" || \ systemctl reboot -i "$@" else echo "WRONG MACHINE. you're on $host." exit 1 fi