check if 0tdns is still running every 15, 30 and 45 minutes past na hour
[0tDNS.git] / src / check_if_done.py
blobc91fea3802648ef04f3a43a4cf774b2e82bd3a7c
1 #!/usr/bin/python3
3 from sys import argv
4 from time import gmtime, strftime
5 from ztdnslib import log
6 from os.path import isfile
8 lockfile = '/var/lib/0tdns/lockfile'
9 if isfile(lockfile):
10 msg = '{} still exists, 0tdns is probably running for too long'\
11 .format(lockfile)
13 print(msg)
15 # this script shall be run 15, 30 and 45 minutes after an hour;
16 # in all cases we want to write to logs, but only at 30 or 45 minutes
17 # we want to email the admin
18 if int(strftime('%M', gmtime())) >= 30 and '--send-mail' in argv:
19 print('Sending mail') # TODO send mail and delete this line
21 log(msg)