diff --git a/README.md b/README.md index fafcded..69984cc 100644 --- a/README.md +++ b/README.md @@ -86,3 +86,7 @@ WOL ENV: * WOL_API = IP of docker host * WOL_API_PORT= port wol_api is running on * WOL_WAIT= time in seconds to wait for host to wake +* WOL_NATIVE_HOST = IP of NAT gateway with forwarded port for WoL * +* WOL_NATIVE_PORT = External port on gateway for forwarding. Ensure that it is mapped to your target machine IP on port 9. * + +*Optional. Only applicable when not using the WoL docker service API and when waking from outside NAT is required. Omit, or leave blank otherwise. diff --git a/root/usr/local/bin/wol_rffmpeg/wol b/root/usr/local/bin/wol_rffmpeg/wol index 895fc9d..019f77f 100755 --- a/root/usr/local/bin/wol_rffmpeg/wol +++ b/root/usr/local/bin/wol_rffmpeg/wol @@ -14,8 +14,15 @@ if [ $RFFMPEG_WOL == "native" ] && [ ! -z $RFFMPEG_HOST ] && [ ! -z $RFFMPEG_HOS then echo WOL enabled echo "$RFFMPEG_HOST" is down, sending wakeup to "$mac" - wakeonlan $mac - #wakeonlan -i $RFFMPEG_HOST $mac + + WOL_OPTIONS="" + if [ ! -z $WOL_NATIVE_HOST ]; then + WOL_OPTIONS="$WOL_OPTIONS -i $WOL_NATIVE_HOST" + fi + if [ ! -z $WOL_NATIVE_PORT ]; then + WOL_OPTIONS="$WOL_OPTIONS -p $WOL_NATIVE_PORT" + fi + wakeonlan $WOL_OPTIONS $mac echo "waiting $WOL_WAIT seconds for $RFFMPEG_HOST to wake" sleep $WOL_WAIT fi