Wake On Lan (wol)

Script bash per habilitar wakeonlan a un servidor amb Linux

#!/bin/bash

NIC=enp3s0

cat >/etc/systemd/system/wol.service <<EOF
[Unit]
Description=Enable Wake On Lan

[Service]
Type=oneshot
ExecStart = /sbin/ethtool --change ${NIC} wol g

[Install]
WantedBy=basic.target

EOF

systemctl daemon-reload
systemctl enable wol.service
systemctl status wol

ethtool ${NIC} | grep Wake-on