Skip to content

Commit 349f33a

Browse files
committed
New automated backups.
1 parent 69c6985 commit 349f33a

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

backups/addresses/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Ignore any file in this directory
2+
*
3+
!/.gitignore

crontab

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
# m h dom mon dow command
2+
#
3+
# EVERY HOUR
4+
# Every hour destroy possible IP addresses from the error logs
5+
0 * * * * sed -i s/'\['client.*'\]'/'\['0.0.0.0'\]'/ /usr/local/lib/ahmia/error/error.log 2>&1
6+
0 * * * * sed -i s/'\['client.*'\]'/'\['0.0.0.0'\]'/ /usr/local/lib/ahmia/error/hs_error.log 2>&1
7+
#
8+
# EVERY DAY
29
# Check every day statistics from Tor2web nodes.
310
0 1 * * * timeout 1800s python /usr/local/lib/ahmia/tools/get_tor2web_domains.py >>/usr/local/lib/ahmia/error/tools_get.log 2>&1
411
# Move Tor2web stats to the database
512
0 2 * * * timeout 9000s python /usr/local/lib/ahmia/tools/use_popularity_data.py >>/usr/local/lib/ahmia/error/tools_popularity.log 2>&1
613
# Check every day which hidden services are online and try to download description.json from them.
714
0 3 * * * timeout 60000s python /usr/local/lib/ahmia/tools/test_hidden_services.py >>/usr/local/lib/ahmia/error/tools_test.log 2>&1
8-
# ONLY ONCE A WEEK: Check the backlinks
9-
0 1 * * 1 timeout 600000s python /usr/local/lib/ahmia/tools/gather_backlinks_data.py >>/usr/local/lib/ahmia/error/tools_backlinks.log 2>&1
10-
# Every hour destroy possible IP addresses from the error logs
11-
0 * * * * sed -i s/'\['client.*'\]'/'\['0.0.0.0'\]'/ /usr/local/lib/ahmia/error/error.log 2>&1
12-
# Once a week remove the whole log files
13-
0 2 * * 1 echo "" > /usr/local/lib/ahmia/error/error.log
14-
0 3 * * 1 echo "" > /usr/local/lib/ahmia/error/access.log
15+
#
16+
#EVERY WEEK
17+
# Once a week analyze and remove the log files
18+
#1 1 * * 1
19+
2 1 * * 1 echo "" > /usr/local/lib/ahmia/error/error.log
20+
3 1 * * 1 echo "" > /usr/local/lib/ahmia/error/access.log
21+
4 1 * * 1 echo "" > /usr/local/lib/ahmia/error/hs_error.log
22+
5 1 * * 1 echo "" > /usr/local/lib/ahmia/error/hs_access.log
23+
# Once a week check the backlinks
24+
#6 1 * * 1 timeout 600000s python /usr/local/lib/ahmia/tools/gather_backlinks_data.py >>/usr/local/lib/ahmia/error/tools_backlinks.log 2>&1
1525
# Once a week create database backup
16-
0 4 * * 1 pg_dump -U ahmia_login ahmia_db -f /usr/local/lib/ahmia/backups/sql/$(date -d "today" +"%Y-%m-%d")-db_backup.sql
26+
7 1 * * 1 pg_dump -U ahmia_login ahmia_db -f /usr/local/lib/ahmia/backups/sql/$(date -d "today" +"%Y-%m-%d")-db_backup.sql
27+
# Create a snapshot from the addresses with their descriptions
28+
8 1 * * 1 curl -i "Content-Type: application/json" https://ahmia.fi/address/ > /usr/local/lib/ahmia/backups/addresses/$(date -d "today" +"%Y-%m-%d")-addresses_snapshot.json

0 commit comments

Comments
 (0)