ad blocking script help

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions
Author Message
blaser
DD-WRT Guru


Joined: 16 Jul 2006
Posts: 504

PostPosted: Sun Aug 23, 2020 11:37    Post subject: ad blocking script help Reply with quote
for ad blocking I'm using an old script.
The script worked until version 43516, since then it stopped working.
I identified a change in the command wait but not sure what
the problematic area is
Code:
  # Each file should be downloaded within 120 seconds
    TEMP_FILE="/tmp/gen_host`echo $COUNT`.tmp"
    ($CURL -s $URL -o $TEMP_FILE) & DOWNLOAD_PID=$!
    (sleep 120 && kill -TERM $DOWNLOAD_PID) & WAITER_PID=$!

    wait $DOWNLOAD_PID
    RESULT=$?
    kill -KILL $WAITER_PID


I see that the line wait $DOWNLOAD_PID doesn't process correctly, it suppose wait for the curl to download the file which it does but I do not get the exist code correctly and it waits 120 sec, when it tried to kill the process it errors out, processes already finished.
Anyone can help?

_________________
Netgear R8500
Sponsor
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 8343

PostPosted: Sun Aug 23, 2020 15:22    Post subject: Reply with quote
If you insist on "rolling your own" anyway, you might want to consider the one in my signature (ddwrt-blacklist-domains.sh). At least it's modern and up to date.
_________________
DD-WRT: DNS Leak Detection w/ VPNs (updated 6/5/19)
ddwrt-ovpn-split-basic.sh (UPDATED!)
ddwrt-ovpn-split-advanced.sh (UPDATED!)
ddwrt-blacklist-domains.sh (UPDATED!)
ddwrt-ovpn-client-backup.sh
ddwrt-mount-usb-drives.sh
ddwrt-ovpn-remote-access.sh
ddwrt-pptp-policy-based-routing.sh
blaser
DD-WRT Guru


Joined: 16 Jul 2006
Posts: 504

PostPosted: Sun Aug 23, 2020 21:13    Post subject: Reply with quote
eibgrad wrote:
If you insist on "rolling your own" anyway, you might want to consider the one in my signature (ddwrt-blacklist-domains.sh). At least it's modern and up to date.


Thanks for your script, I looked inside, similar in the idea of the one I'm using, there are some differences, one of them is if a web site is not responding your script gets stuck and doesn't proceed, that's the reason there is a wait in the one I'm using.

_________________
Netgear R8500
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 8343

PostPosted: Sun Aug 23, 2020 23:56    Post subject: Reply with quote
You make a good point. Something I didn't think about at the time. I'm going to update the script and add that option. Easy enough to change.

UPDATE: Done.

_________________
DD-WRT: DNS Leak Detection w/ VPNs (updated 6/5/19)
ddwrt-ovpn-split-basic.sh (UPDATED!)
ddwrt-ovpn-split-advanced.sh (UPDATED!)
ddwrt-blacklist-domains.sh (UPDATED!)
ddwrt-ovpn-client-backup.sh
ddwrt-mount-usb-drives.sh
ddwrt-ovpn-remote-access.sh
ddwrt-pptp-policy-based-routing.sh
blaser
DD-WRT Guru


Joined: 16 Jul 2006
Posts: 504

PostPosted: Mon Aug 24, 2020 1:37    Post subject: Reply with quote
eibgrad wrote:
You make a good point. Something I didn't think about at the time. I'm going to update the script and add that option. Easy enough to change.

UPDATE: Done.


thanks, good base for me, I will add some support for external whitelist for and external blacklist file.

_________________
Netgear R8500
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum