Just another WordPress site

Wake on lan script

Here is a tiny wakeup script that i wrote:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
DEST_MAC="12:34:56:78:9A:BC"
DEST_HOST="192.168.10.10"
 
 
echo -n "Waking up $DEST_HOST ..."
ether-wake "$DEST_MAC"
if [ "$?" -ne 0 ]; then
        echo " failed!"
        exit 1
fi
 
reachable=0;
while [ $reachable -eq 0 ]; do
        ping -q -c 1 "$DEST_HOST" 1> /dev/null 2>&1
        if [ "$?" -eq 0 ]; then
                reachable=1
        else
                echo -n "."
                sleep 1
        fi
done
echo " OK"

Leave a comment for: "Wake on lan script"

You must be logged in to post a comment.