packages/utils/banhosts/files/updatebanhost
Jan Baier 89dfd41898 banhosts: Call killall with the -s
Some versions of killall do support the `killall -SIGNAL` syntax and
have only `-s SIGNAL` which should be supported everywhere.

I see the problem with *killall (PSmisc) 23.3* on latest TurrisOS 5.2

Signed-off-by: Jan Baier <jan.baier@amagical.net>
2021-09-08 17:13:52 -04:00

19 lines
497 B
Bash

#!/bin/sh
file=/tmp/banhost
gethosts() {
logger -t "banhost[$$]" "Update $file"
wget -qO- http://winhelp2002.mvps.org/hosts.txt |awk 'BEGIN{printf "0.0.0.0"}/^0\.0\.0\.0/{printf " "$2}END{exit(!FNR)}' >$file || exit 1
echo -n $time >$file.time
exec killall -s HUP dnsmasq
}
if [ "$ACTION" = ifup -a "$INTERFACE" = wan ]; then
read time </proc/uptime
time=${time%%.*}
[ -f $file -a -f $file.time ] || gethosts
read oldtime <$file.time
[ $((time - oldtime)) -lt 604800 ] || gethosts
fi