chromebook-linux/reboot-all-chromes.sh
2025-06-12 18:32:21 -05:00

27 lines
469 B
Bash
Executable file

#!/bin/bash
function rebootMachine() {
local machine=$1
if (( ${machine} < 10 )); then
machine="0${machine}"
fi
machine="chrome${machine}.duensing.digital"
echo "Attempting reboot of ${machine}..."
sshpass -p password ssh -o "StrictHostKeyChecking=no" user@${machine} "sudo reboot"
}
which -s sshpass
if [[ $? -eq 1 ]]; then
sudo apt-get install -y sshpass
fi
if [[ -z $1 ]]; then
for i in {1..13}; do
rebootMachine $i
done
else
rebootMachine $1
fi