Created
September 22, 2018 18:11
-
-
Save jb0hn/83dabf447cda3090b5ef193357fbdce4 to your computer and use it in GitHub Desktop.
Shutdown over SSH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# global vars | |
# static | |
USERNAME='user' | |
IP='192.168.0.100' | |
# dynamic | |
command='sudo poweroff' | |
function main() | |
{ | |
# ssh -t | |
# force pseudo-terminal allocation | |
# which can be used to execute arbitrary screen-based programs | |
# on a remote machine | |
ssh -t $USERNAME@IP $command | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment