aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-05-29 12:06:02 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-05-29 12:06:02 +0200
commit248687c37790986e9a7d0bf00bee8973930ae90f (patch)
tree67090d8d8425b46369b58e2d633661bd8f31a8a2
parent862e951caebb97ce4529b4faa4abb56d2c15b762 (diff)
download0tdns-248687c37790986e9a7d0bf00bee8973930ae90f.tar.gz
0tdns-248687c37790986e9a7d0bf00bee8973930ae90f.zip
add python script that will run every hour
-rwxr-xr-xhourly.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/hourly.py b/hourly.py
new file mode 100755
index 0000000..543ed20
--- /dev/null
+++ b/hourly.py
@@ -0,0 +1,20 @@
+#!/bin/python3
+
+from sys import argv
+import subprocess
+
+wrapper = '/var/lib/0tdns/vpn_wrapper.sh'
+perform_queries = '/var/lib/0tdns/perform_queries.py'
+
+def get_vpn_connections(hour):
+ # TODO query database for the necessary information,
+ # for now, return some sample though-up data
+ return (
+ # vpn_id | config_path
+ (14, "./vpngate_178.254.251.12_udp_1195.ovpn"),
+ (13, "./vpngate_public-vpn-229.opengw.net_tcp_443.ovpn")
+ )
+
+hour = argv[1]
+for vpn_id, config_path in get_vpn_connections(hour):
+ subprocess.run([wrapper, config_path, perform_queries, hour])