Wednesday, December 12, 2012

SSH script to wait til machine is up to login

Keeping this around for notes, I actually have another version floating around, but couldn't remember where, so I put this up so I don't have to remember.


## Silly script that doesn't ssh until the machine is up.
## Matthew M. Conley 12/12/12
##
#!/bin/bash


ping -c 1 192.168.1.1;
if [ $? -eq 0 ]; then
ssh user@192.168.1.1

fi





a variable should work so you can just do pingssh.sh 192.16... enter your ip in. and have it load the ip. Thats how my other script runs. Change user to the user you login in as.


ping -c 1 $1;
if [ $? -eq 0 ]; then
ssh user@$1

fi


No comments: