23 lines
510 B
Bash
23 lines
510 B
Bash
#!/bin/bash
|
|
if [ ! -f ${DATA_DIR}/iptables ]; then
|
|
echo "ERROR: iptables not found, please create the file 'iptables' in the main directory!"
|
|
sleep infinity
|
|
else
|
|
while IFS= read -r line; do
|
|
if [ -z "$line" ]; then
|
|
continue
|
|
fi
|
|
echo "Applying: $line"
|
|
eval "$line"
|
|
done < "${DATA_DIR}/iptables"
|
|
fi
|
|
|
|
echo "---Starting...---"
|
|
term_handler() {
|
|
echo "---Stopping Tailscale Forwarder---"
|
|
kill -SIGTERM $(pidof sleep)
|
|
exit 143;
|
|
}
|
|
|
|
trap 'kill ${!}; term_handler' SIGTERM
|
|
sleep infinity |