|
@@ -9,7 +9,7 @@ from pyinotify import IN_MODIFY, IN_DELETE, IN_MOVE_SELF, IN_CREATE
|
|
|
import sys
|
|
|
|
|
|
# Branch off the logging into a seperate file
|
|
|
-from config import log, load_config, add_block, rm_block, check_blocks
|
|
|
+from config import log, load_config, save_config, add_block, rm_block, check_blocks
|
|
|
|
|
|
myConfig = load_config()
|
|
|
|
|
@@ -52,6 +52,8 @@ def checkup():
|
|
|
log.info("Unblock {0}".format(ip))
|
|
|
unblocker(ip)
|
|
|
rm_block(ip)
|
|
|
+ else:
|
|
|
+ log.debug("No blocks found to unblock.")
|
|
|
|
|
|
class EventHandler(ProcessEvent):
|
|
|
def process_IN_MODIFY(self, event):
|
|
@@ -93,6 +95,7 @@ while True:
|
|
|
last = pendulum.parse(myConfig["last_unblock"])
|
|
|
if now.diff(last).in_hours():
|
|
|
myConfig["last_unblock"] = now.to_datetime_string()
|
|
|
+ save_config(myConfig)
|
|
|
checkup()
|
|
|
notifier.process_events()
|
|
|
if notifier.check_events():
|