-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathethtool-wol.init
executable file
·46 lines (40 loc) · 1.03 KB
/
ethtool-wol.init
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/sbin/runscript
description="The script starts the Wake-On-LAN for ethtool"
description_stopwake="Stop Wake-On-LAN in replacements stop"
opts="stopwake"
depend() {
need net
after net
}
checkconfig() {
if [ ! -f /etc/conf.d/ethtool-wol ] ; then
eerror "Is not found /etc/conf.d/ethtool-wol configuration file"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Starting Wake-on-LAN"
if [[ -z `/usr/sbin/ethtool "${ETH_WOL}" | grep 'Supports Wake-on: g'` ]]; then
eerror "Your card does not support Wake-On-LAN"
return 1
fi
/usr/sbin/ethtool -s "${ETH_WOL}" wol g
if [[ -n `/usr/sbin/ethtool ${ETH_WOL} | grep 'Wake-on: d'` ]]; then
eerror "Failed to enable Wake-on-LAN"
return 1
fi
eend $?
}
stopwake() {
description="The script starts the Wake-On-LAN for ethtool"
ebegin "Stopping Wake-on-LAN"
/usr/sbin/ethtool -s "${ETH_WOL}" wol d
if [[ -z `/usr/sbin/ethtool ${ETH_WOL} | grep 'Wake-on: d'` ]]; then
eerror "Unable to disable the Wake-on-LAN"
return 1
else
mark_service_stopped $RC_SVCNAME
fi
eend $?
}