in kif.py [0:0]
def main():
# Get args, if any
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--debug", help="Debug run (don't execute runlists)", action='store_true')
parser.add_argument("-c", "--config", help="Path to the config file if not in ./kif.yaml")
args = parser.parse_args()
if not args.config:
config = yaml.safe_load(open("kif.yaml"))
else:
config = yaml.safe_load(open(args.config))
if os.getuid() != 0:
print("Kif must be run as root!")
sys.exit(-1)
interval = int(config.get('daemon', {})
.get('interval', DEFAULT_INTERVAL))
# Loop forever and ever
while True:
if 'rules' not in config:
print('- NO RULES TO CHECK')
else:
# Now actually run things
actions = scan_for_triggers(config)
if actions:
run_actions(config, actions, args.debug)
# print(f'KIF run finished, waiting {interval} seconds till next run.')
time.sleep(interval)