-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcensorship-cron-pscaiip
executable file
·43 lines (32 loc) · 1.27 KB
/
censorship-cron-pscaiip
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
36
37
38
39
40
41
42
#!/bin/bash
# Modify according to your installation
cd /root/kit-censura
source config.sh
#check if service is enabled
echo $LISTS | grep pscaiip || exit 255
list=pscaiip
test $LOGGING_ENABLE == true && echo "$(date '+%d/%m/%y %H:%M:%S') - updating list $list" >> $LOGFILE
# download the list and parse it
if ! ./update_$list; then
echo "WARNING: $list.update has failed with rc=$?!" >&2
test $LOGGING_ENABLE == true && echo "$(date '+%d/%m/%y %H:%M:%S') - WARNING: $list.update has failed with rc=$?!" >> $LOGFILE
continue
fi
# second sanity check
if [ ! -e lists/$list.new ]; then
echo "WARNING: lists/$list.new has not been created!" >&2
test $LOGGING_ENABLE == true && echo "$(date '+%d/%m/%y %H:%M:%S') - WARNING: lists/$list.new has not been created!" >> $LOGFILE
continue
fi
mv lists/$list.new lists/$list
# The by-IP list is generated only by some sources. The program assumes
# that if the by-name list was generated correctly then this one will
# have been too.
if [ -e lists/$list-ip.new ]; then
mv lists/$list-ip.new lists/$list-ip
fi
./build-bind-config "$LISTS"
./build-unbound-config "$LISTS"
test $LOGGING_ENABLE == true && echo "$(date '+%d/%m/%y %H:%M:%S') - Censorship GET $list ended." >> $LOGFILE
./censorship-summary
./censorship-apply