Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
khvalera committed May 31, 2013
1 parent 81a95f3 commit af7e6b5
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions ethtool-wol.init
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/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
Expand All @@ -15,21 +20,27 @@ checkconfig() {
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 [ -z "/usr/sbin/ethtool ${ETH_WOL} | grep -i 'Wake-on: d'" ]; then
if [[ -n `/usr/sbin/ethtool ${ETH_WOL} | grep 'Wake-on: d'` ]]; then
eerror "Failed to enable Wake-on-LAN"
return 1
fi
eend $?
}

stop() {
set -x
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 -i 'Wake-on: d'" ]; then
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 $?
}

0 comments on commit af7e6b5

Please sign in to comment.