#!/bin/bash

cat /proc/net/dev | awk -F"[:/ ]+" '/eth/ {print $2}' | while read line
do
        ethtool -s $line wol d
done

cfg=/etc/power/wake_lan.conf
if [ ! -f $cfg ] || [ $(cat $cfg | awk -F' = ' '{print $2}') == "0" ]; then
    exit 0
fi

cat /proc/net/dev | awk -F"[:/ ]+" '/eth/ {print $2}' | while read line
do
	ethtool -s $line wol g
done
exit 0