1

I am trying to enable WOL and followed this answer: How can I enable wake-on-lan permanently?

As per the link, I created an upstart job to enable WOL upon reboot. Script is:

start on started network

script
for interface in $(cut -d: -f1 /proc/net/dev | tail -n +3); do
    logger -t 'wakeonlan init script' enabling wake on lan for $interface
    ethtool -s $interface wol g
done
end script

Named the script wakeonlan.conf and it's located in /etc/init/. I can start the job by:

   sudo service wakeonlan start

This starts successfully and WOL is enabled on eth0.

However on reboot, the upstart job fails to start. The wakeonlan.log shows:

Cannot get current wake-on-lan settings: Operation not supported
not setting wol

I'm not sure what to do next?

user288911
  • 11
  • 1

1 Answers1

1

First, there is no job by the name of "network" on ubuntu 12.04. You should use started networking instead.

Next, perhaps making this an instance job would help. Try this:

start on net-device-up

instance $IFACE

task

pre-start exec logger -t 'wakeonlan init script' enabling wake on lan for $IFACE

exec ethtool -s $IFACE wol g

What I think is happening is that the one interface in /proc/net/dev does not support wol, and so your job does not continue with the rest of the interfaces. The job above will turn on wol for each interface individually, so one failing does not affect the others. In addition, this job works when your interfaces come up post-boot (hotplug).

CameronNemo
  • 1,675