summaryrefslogtreecommitdiffstats
path: root/wakey
blob: 0201b9068ebb634f7ea7e670464ef28adace2677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#! /bin/bash
[ $# -lt 2 ] && echo "missing mandatory arguments 'hostname' 'mac'" && exit 1
host=$1
mac=$2
CPT=0
while [ ${CPT} -ne 10 ]; do
    CPT=$((CPT+1))
    wol $mac
    ping -c 1 -W 5 $host 2>&1 >/dev/null
    [ $? -eq 0 ] && break
    sleep 5
done
[ $? -ne 0 ] && echo " he is still asleep !" && exit 1
echo "$host is up, have fun!"