summaryrefslogtreecommitdiffstats
path: root/triggers/restart-services.trigger
blob: b65b825254eb9077b8175decc62e1e8bdab610db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python

import cobbler.api as capi
import os
import sys

bootapi = capi.BootAPI()
settings = bootapi.settings()
manage_dhcp = str(settings.manage_dhcp).lower()
manage_dhcp_mode = str(settings.manage_dhcp_mode).lower()

rc = 0
if manage_dhcp != "0":
    if manage_dhcp_mode == "isc":
        rc = os.system("/sbin/service dhcpd restart")
    elif manage_dhcp_mode == "dnsmasq":
        rc = os.system("/sbin/service dnsmasq restart")
    else:
        print "- error: unknown DHCP engine: %s" % manage_dhcp_mode
        rc = 411

sys.exit(rc)