aboutsummaryrefslogtreecommitdiff
path: root/src/hourly.py
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-06-17 14:24:24 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-06-17 14:24:24 +0200
commit1017dfb223bc857a2327dbad90b8c68e8664d3fe (patch)
treea852725839bf5dc72965e3d3c98da6b4ebf656ee /src/hourly.py
parent7caef553b4061b6179c2757cb3bbd4e17e892cf7 (diff)
download0tdns-1017dfb223bc857a2327dbad90b8c68e8664d3fe.tar.gz
0tdns-1017dfb223bc857a2327dbad90b8c68e8664d3fe.zip
prepend log message with an hour
Diffstat (limited to 'src/hourly.py')
-rwxr-xr-xsrc/hourly.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hourly.py b/src/hourly.py
index 4fd30a6..ecf1f10 100755
--- a/src/hourly.py
+++ b/src/hourly.py
@@ -10,7 +10,7 @@ import psycopg2
# our own module used by several scripts in the project
from ztdnslib import start_db_connection, \
- get_default_host_address, get_ztdns_config, log
+ get_default_host_address, get_ztdns_config, log, set_loghour
wrapper = '/var/lib/0tdns/vpn_wrapper.sh'
perform_queries = '/var/lib/0tdns/perform_queries.py'
@@ -251,6 +251,8 @@ def do_hourly_work(hour):
# round down to an hour - this datetime format is one
# of the formats accepted by postgres
hour = strftime('%Y-%m-%d %H:00%z', gmtime())
+set_loghour(hour) # log() function will now prepend messages with hour
+
if not lock_on_file():
log('Failed trying to run for {}; {} exists'.format(hour, lockfile))
else: