File: test-localhost

package info (click to toggle)
wakeonlan 0.42-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 164 kB
  • sloc: perl: 228; sh: 22; makefile: 5
file content (32 lines) | stat: -rwxr-xr-x 528 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

set -e

WAKEONLAN=wakeonlan
MAC=00:11:22:33:44:55

retval=0

if type $WAKEONLAN > /dev/null 2>&1 ; then
    echo success: Found $WAKEONLAN in PATH
else
    echo error: Failed to find $WAKEONLAN in PATH
    retval=1
fi

t=$(mktemp)

$WAKEONLAN -i 127.0.0.1 $MAC > "$t" 2>&1 || true

if grep -q "Sending magic packet to 127.0.0.1:9 with payload 00:11:22:33:44:55" "$t"
then
    echo success: Calling $WAKEONLAN worked.
else
    echo error: Calling $WAKEONLAN failed.
    cat "$t"
    retval=1
fi

rm "$t"

exit $retval