Skip to content

Commit

Permalink
Creation
Browse files Browse the repository at this point in the history
  • Loading branch information
khvalera committed May 31, 2013
0 parents commit 81a95f3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ethtool-wol.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# /etc/conf.d/ethtool-wol: config file for /etc/init.d/ethtool-wol

ETH_WOL="eth0"
35 changes: 35 additions & 0 deletions ethtool-wol.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/sbin/runscript

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"
/usr/sbin/ethtool -s "${ETH_WOL}" wol g
if [ -z "/usr/sbin/ethtool ${ETH_WOL} | grep -i 'Wake-on: d'" ]; then
eerror "Failed to enable Wake-on-LAN"
return 1
fi
eend $?
}

stop() {
set -x
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
eerror "Unable to disable the Wake-on-LAN"
return 1
fi
eend $?
}

0 comments on commit 81a95f3

Please sign in to comment.