Skip to content

Instantly share code, notes, and snippets.

@abhilash1in
Created February 8, 2017 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhilash1in/01812f050677081a9c5568f4a84afc00 to your computer and use it in GitHub Desktop.
Save abhilash1in/01812f050677081a9c5568f4a84afc00 to your computer and use it in GitHub Desktop.
Reboot systems over SSH
#!/bin/bash
USERNAME=5c
HOST="172.1.4."
SCRIPT="echo aryabhatta | sudo -S reboot"
for i in {59..67} ; do
sshpass -p"aryabhatta" ssh -o StrictHostKeyChecking=no ${USERNAME}@${HOST}$i "${SCRIPT}"
done
for i in {69..150} ; do
sshpass -p"aryabhatta" ssh -o StrictHostKeyChecking=no ${USERNAME}@${HOST}$i "${SCRIPT}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment