Wake-on-LAN and systemd

To use systemd – create a new service unit file /etc/systemd/system/wol@.service:

[Unit]
Description=Wake-on-LAN for %I
Requires=network.target
After=network.target

[Service]
ExecStart=/sbin/ethtool -s %I wol g
Type=oneshot

[Install]
WantedBy=multi-user.target

Then activate this new service for your network adapter:

# ln -s /etc/systemd/system/wol\@.service /etc/systemd/system/multi-user.target.wants/wol\@eth0.service
# systemctl --system daemon-reload
# systemctl start wol\@eth0.service
# systemctl status wol\@eth0.service
wol@eth0.service - Wake-on-LAN for eth0
	  Loaded: loaded (/etc/systemd/system/wol@.service; enabled)
	  Active: inactive (dead) since Mon, 21 May 2012 12:12:06 +0300; 6s ago
	 Process: 1971 ExecStart=/sbin/ethtool -s %I wol g (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/wol@.service/eth0

Help: http://0pointer.de/blog/projects/instances.html

Scroll to top