Commit 99ff89ec authored by aoh's avatar aoh
Browse files

Add cron script for removing unused files


Signed-off-by: aoh's avataraoh <aoh@lysator.liu.se>
parent 4275b93f
Pipeline #355 failed with stages
#!/usr/bin/env python3
import os
from db import DB
path='/usr/local/etc/namedb/master/'
for f in os.listdir(path):
remove = True
with DB() as d:
for id in d.get_domain_ids():
if f == d.get_domain_name(id):
remove = False
break
if remove:
print("Remove file {}".format(f))
# TODO actual file removal
# TODO logging?
os.unlink(path + f)
else:
print("Keep file {}".format(f))
# TODO actual file keepal
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment