可以試建立
/etc/init.d/halt.local
~~~內容如下
# script with local commands to be executed from init on system shutdown
#
# Here you should add things, that should happen directly before shuting
# down.
#
# enable WOL for magic packet (g) and broadcast (b)
#wol pumbagsd...
# Set Wake-on-LAN options. Not all devices support this. The
# argument to this option is a string of characters specifying
# which options to enable.
# p Wake on phy activity
# u Wake on unicast messages
# m Wake on multicast messages
# b Wake on broadcast messages
# a Wake on ARP
# g Wake on MagicPacket(tm)
# s Enable SecureOn(tm) password for MagicPacket(tm)
# d Disable (wake on nothing). This option clears all previous
# options.
/sbin/ifup eth0
/usr/sbin/ethtool -s eth0 wol g
#/usr/sbin/ethtool eth0
沒有ethtool 要先安裝 ethtool 套件:
apt-get install ethtool
執行 ethtool:
$ ethtool eth0
Settings for eth0:
Supports Wake-on: g
Wake-on: d
Link detected: yes
主要要看 Wake-on 這一項,要設成 g:
$ ethtool -s eth0 wol g
在執行一次 ethtool 確認有設定好:
$ ethtool eth0
Settings for eth0:
Supports Wake-on: g
Wake-on: g
Link detected: yes
由於這是在電腦開機前動作,
被喚醒的電腦只需要有 BIOS 及硬體有支援即可!
這樣就 ok 了。