[Script] Adblock Plus Filters for Privoxy (without Optware)

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Author Message
rocky13
DD-WRT User


Joined: 25 Apr 2008
Posts: 158

PostPosted: Wed Feb 25, 2015 0:16    Post subject: Reply with quote
Kalonji25 wrote:
@Rocky13

Thank again,

Please see attached images.

I must have missed something, I see the log file was being generated but the actually filer files where never updated.

I'll just run it manually for now until I figure out what I am doing wrong.


Looking at your image, was this created via cron job? or did you manually run the script?. Because it looks like it updated your filter files correctly. Mine is the same.
Sponsor
Kalonji25
DD-WRT Novice


Joined: 07 Jan 2007
Posts: 34

PostPosted: Wed Feb 25, 2015 0:27    Post subject: Reply with quote
I manually ran the script.
_________________
Netgear R7000
DD-WRT v24-sp2 (02/26/15) kongac
jebise101
DD-WRT Guru


Joined: 25 Sep 2009
Posts: 594

PostPosted: Wed Feb 25, 2015 1:37    Post subject: Reply with quote
does transparent mode need to be enabled? using Kong PDB on my R7000 and although I have no issues with the script, when I enable transparent mode it messes up my firewall rules for the guest network i.e guest can get to the webui of router.
Wycleff1971
DD-WRT Novice


Joined: 02 Nov 2013
Posts: 11

PostPosted: Thu Feb 26, 2015 13:48    Post subject: Reply with quote
Hi,

Can someone please Share a packed (.zip/.rar) ready to copy to Router version of the privoxy-blocklist.sh (from github) or submit it to me?

Everytime i try to Download the privoxy-blocklist.sh from Github, it changes it Format and i cant run it on my Router, because i get syntax errors.
Even the use of Textmate doesnt help:(


Please can someone pack and post it?
That would really help me:)

Thanks!
jebise101
DD-WRT Guru


Joined: 25 Sep 2009
Posts: 594

PostPosted: Fri Feb 27, 2015 0:02    Post subject: Reply with quote
just click it in github and copy and past the text. Had the same issue, created a blank file on the router using winscp and pasted the contents.
Kalonji25
DD-WRT Novice


Joined: 07 Jan 2007
Posts: 34

PostPosted: Sat Feb 28, 2015 3:08    Post subject: Reply with quote
Hello All,
I need serious help, I running privoxy with custom Adplus filter. My problem is I want my filters to update daily via cron automatically; I set everything up as shown in the picture below.

I have also post a copy of the script that works fabulously manually.

Code:

#!/bin/sh

# Created for adblock, to update and log activity when script has started and ended.
# Don't forget to chmod +rw

# wait for a bit (5 seconds)... depending on your router you can make this longer or shorter
sleep 5

# change path to suit your installation
path="/jffs/privoxy-blocklist.sh"

# launch the script
# add a empty line in log
echo >> /jffs/adblock/log/run.log
echo "Adblock Started - "$(date) >> /jffs/adblock/log/run.log 2>&1
sh /jffs/privoxy-blocklist.sh
echo "Adblock Finished - "$(date) >> /jffs/adblock/log/run.log 2>&1
echo "----------------------------" >> /jffs/adblock/log/run.log 2>&1
exit


Any insight will be greatly appreciated.



jffs.JPG
 Description:
current location of my script courtesy of Rocky13. Script works well when I run it manually from Putty. I can manually update all my filters, and print a log once its finish.
 Filesize:  50.6 KB
 Viewed:  14575 Time(s)

jffs.JPG



crontab.JPG
 Description:
my currently script that is not running.
 Filesize:  38.46 KB
 Viewed:  14575 Time(s)

crontab.JPG



_________________
Netgear R7000
DD-WRT v24-sp2 (02/26/15) kongac
jebise101
DD-WRT Guru


Joined: 25 Sep 2009
Posts: 594

PostPosted: Sun Mar 01, 2015 17:46    Post subject: Reply with quote
Rocky see error in bold, so people like me don't run into issues in the future. BTW this worked perfectly, don't care for logs as I can see the date and time change since others are having issues.

rocky13 wrote:
Kalonji25 wrote:
Hello.... Question

Is there anyway to run the "sh jffs/etc/privoxy-blocking.sh" script bi-weekly or weekly automatically?? Currently I'm doing this manually to update the filters.

Will love to automate this process if possible.

Thx in advance.


You can do the following.

Under Administration > Management > look under Cron. Make sure it's enabled then under it enter e.g.

#Update Daily @12AM
0 0 * * * root sh /opt/adblock/adblock.sh

apply settings when done. either restart your router or do a stopservice cron && startservice cron in CLI

you are good to go.
Just make sure you enter the correct path

Below is the script I made to run adblocker. as it as whatever you like.

#!/bin/sh
# Don't forget to chmod +rw
# wait for a bit (5 seconds)... depending on your router you can make this longer or shorter
sleep 5

# change path to suit your installation
path="/opt/adblock"

# launch the script
sh $path/privoxy-blocklist.sh


Last edited by jebise101 on Sun Mar 01, 2015 17:54; edited 1 time in total
jebise101
DD-WRT Guru


Joined: 25 Sep 2009
Posts: 594

PostPosted: Sun Mar 01, 2015 17:50    Post subject: Reply with quote
Kalonji25 wrote:
Hello All,
I need serious help, I running privoxy with custom Adplus filter. My problem is I want my filters to update daily via cron automatically; I set everything up as shown in the picture below.

I have also post a copy of the script that works fabulously manually.

Code:

#!/bin/sh

# Created for adblock, to update and log activity when script has started and ended.
# Don't forget to chmod +rw

# wait for a bit (5 seconds)... depending on your router you can make this longer or shorter
sleep 5

# change path to suit your installation
path="/jffs/privoxy-blocklist.sh"

# launch the script
# add a empty line in log
echo >> /jffs/adblock/log/run.log
echo "Adblock Started - "$(date) >> /jffs/adblock/log/run.log 2>&1
sh /jffs/privoxy-blocklist.sh
echo "Adblock Finished - "$(date) >> /jffs/adblock/log/run.log 2>&1
echo "----------------------------" >> /jffs/adblock/log/run.log 2>&1
exit


Any insight will be greatly appreciated.


you are missing a * there should be 3 in the crontab "24 21 * * * root sh". LMK if it works and I will add logs to mine as well Cool
Kalonji25
DD-WRT Novice


Joined: 07 Jan 2007
Posts: 34

PostPosted: Sun Mar 01, 2015 18:42    Post subject: Reply with quote
@jebise101

no luck, I have tried all the about listed below.

Code:

#Update Daily 1:40PM / Print start log - Stop log
40 13 * * * root /jffs/etc/crontab/privoxy-r7000.sh


Code:

#2
#Update Daily 1:40PM / Print start log - Stop log
40 13 * * * sh root /jffs/etc/crontab/privoxy-r7000.sh


for all this headache I might as well run it manually daily myself.

I'm going to see if there is and update firmware via
putty ddup --flash-latest

this is truly starting to drive me crazy.

_________________
Netgear R7000
DD-WRT v24-sp2 (02/26/15) kongac
Kalonji25
DD-WRT Novice


Joined: 07 Jan 2007
Posts: 34

PostPosted: Sun Mar 01, 2015 18:46    Post subject: Reply with quote
Updating firmware

root@DD-WRT:~# ddup --flash-latest
New release 26365 for Netgear R7000 available.
Do you want to update (y/n) [default=n]:

let see if this will resolve my issue.

Update
Still no luck. Beside cron is there any other way I can run this script automatically ?

_________________
Netgear R7000
DD-WRT v24-sp2 (02/26/15) kongac
jebise101
DD-WRT Guru


Joined: 25 Sep 2009
Posts: 594

PostPosted: Mon Mar 02, 2015 1:10    Post subject: Reply with quote
Kalonji25 wrote:
Updating firmware

root@DD-WRT:~# ddup --flash-latest
New release 26365 for Netgear R7000 available.
Do you want to update (y/n) [default=n]:

let see if this will resolve my issue.

Update
Still no luck. Beside cron is there any other way I can run this script automatically ?


your path to the privoxy installation is wrong as well, it should point to privoxy folder in /jffs not the sh file.

Code:
#!/bin/sh

# Created for adblock, to update and log activity when script has started and ended.
# Don't forget to chmod +rw

# wait for a bit (5 seconds)... depending on your router you can make this longer or shorter
sleep 5

# change path to suit your installation
path="/jffs/privoxy"

# launch the script
# add a empty line in log
echo >> /jffs/adblock/log/run.log
echo "Adblock Started - "$(date) >> /jffs/adblock/log/run.log 2>&1
sh /jffs/privoxy-blocklist.sh
echo "Adblock Finished - "$(date) >> /jffs/adblock/log/run.log 2>&1
echo "----------------------------" >> /jffs/adblock/log/run.log 2>&1
exit


The sh must run after the root command not before

Code:
#2
#Update Daily 1:40PM / Print start log - Stop log
40 13 * * *  root sh /jffs/etc/crontab/privoxy-r7000.sh
rocky13
DD-WRT User


Joined: 25 Apr 2008
Posts: 158

PostPosted: Mon Mar 02, 2015 2:53    Post subject: Reply with quote
Kalonji25 wrote:
Updating firmware

root@DD-WRT:~# ddup --flash-latest
New release 26365 for Netgear R7000 available.
Do you want to update (y/n) [default=n]:

let see if this will resolve my issue.

Update
Still no luck. Beside cron is there any other way I can run this script automatically ?


Did you set execution rights to your sh file?. chmod +rw filename, or you can do it in scp. With or without the sh in cron still should work as it does for me. Also when you create a cron entry you must trigger it by entering in CLI. stopservice cron && startservice cron

Have you tried those?.
Kalonji25
DD-WRT Novice


Joined: 07 Jan 2007
Posts: 34

PostPosted: Mon Mar 02, 2015 6:33    Post subject: Reply with quote
I want to say thank you to all who have helped me troubleshoot. After making the changes suggest by @jebise101, and insight by @rocky13. I was successful with getting my script to run via cron.

Code:


#!/bin/sh

# Created for adblock, to update and log activity when script has started and ended.
# Don't forget to chmod +rw

# wait for a bit (5 seconds)... depending on your router you can make this longer or shorter
sleep 5

# change path to suit your installation
#thanks to jebise101 for the correction
path="/jffs/etc/privoxy"

# launch the script
# add a empty line in log
echo >> /jffs/adblock/log/run.log
echo "Adblock Started - "$(date) >> /jffs/adblock/log/run.log 2>&1
sh /jffs/privoxy-blocklist.sh
echo "Adblock Finished - "$(date) >> /jffs/adblock/log/run.log 2>&1
echo "----------------------------" >> /jffs/adblock/log/run.log 2>&1
exit

Code:

#Update Daily 1:15AM / Print start log - Stop log
15 01 * * *  root sh /jffs/privoxy-r7000.sh


Code:

#thanks rocky13
CLI. stopservice cron && startservice cron


Only one issue but its not that serious. the log is printing incorrect time.
Code:

Adblock Started - Mon Mar 2 06:15:05 GMT 2015
Adblock Finished - Mon Mar 2 06:15:57 GMT 2015


the time is set correctly on the router, with GMT -5 for my timezone(NYC).
Router: current firmware: Firmware: DD-WRT v24-sp2 (02/26/15) kongac
Time: reflecting the correct time.
Thanks again to all for the wealth of knowledge.

_________________
Netgear R7000
DD-WRT v24-sp2 (02/26/15) kongac
jebise101
DD-WRT Guru


Joined: 25 Sep 2009
Posts: 594

PostPosted: Mon Mar 02, 2015 13:03    Post subject: Reply with quote
Noticed that to, did you reboot? Think the script ran before the router got the correct time at least that's what I think happened. Didn't get a chance to check my logs this morning, run mine at 5AM.

Do you notice the Internet stops working while the script is updating, it only last about 30 seconds which is why I run it in the morning.
Kalonji25
DD-WRT Novice


Joined: 07 Jan 2007
Posts: 34

PostPosted: Thu Mar 05, 2015 4:01    Post subject: Reply with quote
I have rebooted several times, the log time is off by 5 hours. No big deal if It continues I will just disable to log.

-

jebise101 wrote:
Noticed that to, did you reboot? Think the script ran before the router got the correct time at least that's what I think happened. Didn't get a chance to check my logs this morning, run mine at 5AM.

Do you notice the Internet stops working while the script is updating, it only last about 30 seconds which is why I run it in the morning.

_________________
Netgear R7000
DD-WRT v24-sp2 (02/26/15) kongac
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next Display posts from previous:    Page 5 of 8
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware 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