Skip to content

Instantly share code, notes, and snippets.

@n7st
Created March 22, 2016 16:52
Show Gist options
  • Save n7st/0cb0b9cb4fc549c40b8a to your computer and use it in GitHub Desktop.
Save n7st/0cb0b9cb4fc549c40b8a to your computer and use it in GitHub Desktop.
Script to put on crontab. Wakes a server if IP provided as parameter (e.g. 192.168.1.98) is currently connected to the network.
#!/usr/bin/env bash
# $1 should be an IP address
/usr/sbin/arp -d $1 > /dev/null 2>&1;
/usr/bin/arp-scan -l > /dev/null 2>&1;
[[ $(/usr/sbin/arp -n $1 | grep "ether") ]] && /usr/sbin/etherwake -b ETHERNET_ADDRESS_OF_SERVER_HERE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment