Scripting

Wake On Lan Setup On Ubuntu

Paste this into a console that has root access:

if ! [ -d ~/bin ]; then
mkdir ~/bin
export PATH="~/bin:$PATH"
fi

sudo sh -c "cat > /etc/init.d/wakeonlanconfig" <<EOF
#!/bin/bash
ethtool -s eth0 wol g
exit
EOF

sudo chmod +x /etc/init.d/wakeonlanconfig
sudo update-rc.d -f wakeonlanconfig defaults
sudo /etc/init.d/wakeonlanconfig

echo 'done.'
echo 'you should be able to start your pc by issuing the following command from another pc: '
echo 'wakeonlan' `ifconfig | grep HW |awk '{print $5}'`
echo