Skip to content

Instantly share code, notes, and snippets.

@ttscoff
Created November 12, 2013 21:30
Show Gist options
  • Save ttscoff/7439119 to your computer and use it in GitHub Desktop.
Save ttscoff/7439119 to your computer and use it in GitHub Desktop.
Wake remote Mac on local network
#!/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