Created
November 12, 2013 21:30
-
-
Save ttscoff/7439119 to your computer and use it in GitHub Desktop.
Wake remote Mac on local network
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 | |
if [[ $1 =~ ((mb)?air|pibble) ]]; then | |
target="pibble.local" | |
else | |
target="macpro.local" | |
fi | |
ping -c 1 $target &> /dev/null | |
if [[ $? == 0 ]]; then | |
echo "Waking $target" | |
ssh $target caffeinate -u -t 5 | |
exit $? | |
else | |
echo "$target not found on network" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment