diff options
author | Wojciech Kosior <kwojtus@protonmail.com> | 2020-06-18 10:38:09 +0200 |
---|---|---|
committer | Wojciech Kosior <kwojtus@protonmail.com> | 2020-06-18 10:38:09 +0200 |
commit | 9d361e9622f87ce6425999db442b49ca5d2b65a2 (patch) | |
tree | f5e5b7d4729b29caa314037c9caa816a1c9901fe /src | |
parent | df8b80af891b3680762d45d77837a8b9c62e8a72 (diff) | |
download | 0tdns-9d361e9622f87ce6425999db442b49ca5d2b65a2.tar.gz 0tdns-9d361e9622f87ce6425999db442b49ca5d2b65a2.zip |
check if 0tdns is still running every 15, 30 and 45 minutes past na hour
Diffstat (limited to 'src')
-rw-r--r-- | src/check_if_done.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/check_if_done.py b/src/check_if_done.py new file mode 100644 index 0000000..c91fea3 --- /dev/null +++ b/src/check_if_done.py @@ -0,0 +1,21 @@ +#!/usr/bin/python3 + +from sys import argv +from time import gmtime, strftime +from ztdnslib import log +from os.path import isfile + +lockfile = '/var/lib/0tdns/lockfile' +if isfile(lockfile): + msg = '{} still exists, 0tdns is probably running for too long'\ + .format(lockfile) + + print(msg) + + # this script shall be run 15, 30 and 45 minutes after an hour; + # in all cases we want to write to logs, but only at 30 or 45 minutes + # we want to email the admin + if int(strftime('%M', gmtime())) >= 30 and '--send-mail' in argv: + print('Sending mail') # TODO send mail and delete this line + + log(msg) |