aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-06-04 20:51:02 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-06-04 20:51:02 +0200
commit95beffcb8b8e69afdf2b83dfe5c4b01e515c67d6 (patch)
treef62b3266103d8d716a574df1a14aa005114c4924 /src
parent3dbec14a792b2ea6d8f67a6090d57f0f1859e6d9 (diff)
download0tdns-95beffcb8b8e69afdf2b83dfe5c4b01e515c67d6.tar.gz
0tdns-95beffcb8b8e69afdf2b83dfe5c4b01e515c67d6.zip
get current date from within python
Diffstat (limited to 'src')
-rwxr-xr-xsrc/hourly.py6
-rwxr-xr-xsrc/hourly.sh3
2 files changed, 5 insertions, 4 deletions
diff --git a/src/hourly.py b/src/hourly.py
index 34097a3..5306a85 100755
--- a/src/hourly.py
+++ b/src/hourly.py
@@ -3,6 +3,7 @@
from sys import argv
import subprocess
from os import path
+from time import gmtime, strftime
# our own module used by several scripts in the project
from ztdns_db_connectivity import start_db_connection
@@ -38,7 +39,10 @@ def get_vpn_connections(cursor, hour):
connection = start_db_connection()
cursor = connection.cursor()
-hour = argv[1]
+# round down to an hour - this datetime format is one
+# of the formats accepted by postgres
+hour = strftime('%Y-%m-%d %H:00', gmtime())
+
vpns = get_vpn_connections(cursor, hour)
for vpn_id, config_hash in vpns:
diff --git a/src/hourly.sh b/src/hourly.sh
deleted file mode 100755
index be1c52a..0000000
--- a/src/hourly.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-hourly.py "`date '+%Y-%m-%d %H:00'`"