diff --git a/imageroot/events/module-removed/10restart_dnsmasq b/imageroot/events/module-removed/10restart_dnsmasq new file mode 100755 index 0000000..8161653 --- /dev/null +++ b/imageroot/events/module-removed/10restart_dnsmasq @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +# +# Copyright (C) 2024 Nethesis S.r.l. +# SPDX-License-Identifier: GPL-3.0-or-later +# + +import json +import os +import sys + +import agent + +data = json.load(sys.stdin) + +# skip if the event comes from another node +if os.environ['NODE_ID'] != str(data['node']): + sys.exit(0) + +agent.run_helper('systemctl', 'restart', os.getenv('MODULE_ID'))