Hello! I am attempting to set up what I have seen described in some guides online where I will be able to allow my computer that runs as a Plex media server to go to sleep and then wake using WOL when users attempt to send a request to the Plex port 32400. I have successfully installed etherwake and luci-app-wol and confirmed I am able to manually wake on lan the computer so that is all working as expected. The issue I am confronted with is that I am unsure how to configure the router to send WOL commands to the computer when Plex access is attempted like described in the guides. I found this thread here: https://forum.archive.openwrt.org/viewtopic.php?id=68357 and this script I am having trouble locating the thread I found in my history sorry but code here
`#!/bin/sh
PINGS_CNT=1
SRV_IP=192.168.x.xxx #My server local IP
SRV_MAC=xx:xx:xx:xx:xx:xx #My server MAC working with manual WOL
SRV_PORT=32400
#BC_IP=192.168.0.255
WOL=/usr/bin/etherwake
LOG=/var/log/wol
logger -p user.info -t PLEX "[date -Iseconds
] PLEX Wake on LAN serevice was started."
ip -D FORWARD -p tcp --dport 32400 -m state --state NEW -j LOG --log-prefix "PLEX Connection "
ip -I FORWARD -p tcp --dport 32400 -m state --state NEW -j LOG --log-prefix "PLEX Connection "
#echo "Log was truncated at [date -Iseconds
]" > $LOG # Truncate log
logread -f | while read LOG_LINE; do
DST=echo $LOG_LINE | grep -Fo "DST=$SRV_IP"
DPT=echo $LOG_LINE | grep -Fo "DPT=$SRV_PORT"
if [ "$DST" == "" -o "$DPT" == "" ]; then
continue
fi
#SRC_IP=echo $LOG_LINE | grep -Fo "SRC=" | sed -e "s/SRC=//g"
SRC_IP=echo $LOG_LINE | grep -Fo "SRC="
if [ "$SRC_IP" != "" ]; then
# Found a matching line. Try to ping the server
PING_RSLT=ping -c $PINGS_CNT -W 1 $SRV_IP 2> /dev/null | awk '/packets received/ {print $4}'
if [ "$PING_RSLT" != "$PINGS_CNT" ]; then
# Guess it's sleeping. Send WoL.
#echo "[date -Iseconds
] $SRC_IP causes PLEX SRV WoL." >> $LOG
#logger -p user.info -t PLEX "[date -Iseconds
] $SRC_IP causes PLEX SRV Wake on LAN."
logger -p user.info -t PLEX "[date -Iseconds
] PLEX SRV Wake on LAN was triggered."
$WOL $SRV_MAC #>> $LOG
#else
#echo "[date -Iseconds
] PLEX SRV $SRV_IP was accessed by $SRC_IP and is alive." >> $LOG
#logger -p user.info -t PLEX "[date -Iseconds
] SRV is alive"
fi
fi
done`
the issue I am confronted with is the iptables commands do not run as my device has nftables, and I cannot install it iptables because the kernal of my image is out of date. Is there a way to still make this work without reimaging and starting from scratch?