-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadsblocker.sh
More file actions
35 lines (27 loc) · 833 Bytes
/
adsblocker.sh
File metadata and controls
35 lines (27 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
echo "...Start..."
apt-get update
apt-get upgrade -y
echo "....Installing Bind9...."
#Installing Bind9 (DNS Server)
apt-get install -y bind9
echo "....Copying Configuration Fles..."
cp named.conf /etc/bind/named.conf
cp adsblocker.py /etc/bind/adsblocker.py
echo "....Fetch updated domain list..."
python3 adsblocker.py
echo "...Restart Services..."
systemctl restart named
systemctl restart bind9
echo "...Verify Data..."
named-checkconf
named-checkconf rpz /etc/bind/adsblocker.db
#Schedule Cron Job to fetch updated domain list
echo "...set Cronjob for future update..."
crontab -l > adsblocker
#cron job which will run at 00:00 on Sunday.
echo "0 0 * * 0 sudo python3 /etc/bind/adsblocker.py>> /etc/bnd/adsblocker.log" >> adsblocker
#install new cron file
crontab adsblocker
rm adsblocker
echo "...Finish... "