def startService(): if not sutils.isFileExecutableByOwner(consts.script): sutils.addExecPermissions(execDir, True); smartmontools.checkConfigurationFilesExistance(); if addon.getSetting(consts.settingDBupdates ) == "true": smartmontools.updateDatabase(); if addon.getSetting(consts.settingRunDaemonOnStartup ) == "true": smartd.startDaemon(); if smartd.daemonRunning(): if addon.getSetting(consts.settingSmartdStartupPopup) == True: xbmc.executebuiltin("Notification(smartmontools, " + addon.getLocalizedString(50001)+ ", 7, " + icon + ")"); # smartd started else: xbmc.log(consts.logHeader + "failed to start smartd", xbmc.LOGERROR); xbmcgui.Dialog().ok(consts.dialogHeader, addon.getLocalizedString(50024));
def startService(): if not sutils.isFileExecutableByOwner(consts.script): sutils.addExecPermissions(execDir, True) smartmontools.checkConfigurationFilesExistance() if addon.getSetting(consts.settingDBupdates) == "true": smartmontools.updateDatabase() if addon.getSetting(consts.settingRunDaemonOnStartup) == "true": smartd.startDaemon() if smartd.daemonRunning(): if addon.getSetting(consts.settingSmartdStartupPopup) == True: xbmc.executebuiltin("Notification(smartmontools, " + addon.getLocalizedString(50001) + ", 7, " + icon + ")") # smartd started else: xbmc.log(consts.logHeader + "failed to start smartd", xbmc.LOGERROR) xbmcgui.Dialog().ok(consts.dialogHeader, addon.getLocalizedString(50024))
shell=True) output, errors = p.communicate() xbmc.log("dhclient s out: " + str(output), level=xbmc.LOGDEBUG) xbmc.log("dhclient e out: " + str(errors), xbmc.LOGERROR if errors else xbmc.LOGDEBUG) cmd = "dhrelay.stop" xbmc.log("dhrelay: stopping service if running: " + cmd, level=xbmc.LOGDEBUG) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) output, errors = p.communicate() xbmc.log("dhcrelay s out: " + str(output), level=xbmc.LOGDEBUG) xbmc.log("dhcrelay e out: " + str(errors), xbmc.LOGERROR if errors else xbmc.LOGDEBUG) checkDirExistence() checkConfigFileExistence() sutils.addExecPermissions(execDir, True) startService() while (not xbmc.abortRequested): xbmc.sleep(250) stopService()
xbmc.log("dhcpd s out:" + str(output), level=xbmc.LOGDEBUG); xbmc.log("dhcpd e out:" + str(errors), xbmc.LOGERROR if errors else xbmc.LOGDEBUG); cmd = "dhclient.stop" ; xbmc.log("dhclient: stopping service if running: " + cmd, level=xbmc.LOGDEBUG); p = subprocess.Popen(cmd, stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=True); output, errors = p.communicate(); xbmc.log("dhclient s out: " + str(output), level=xbmc.LOGDEBUG); xbmc.log("dhclient e out: " + str(errors), xbmc.LOGERROR if errors else xbmc.LOGDEBUG) cmd = "dhrelay.stop" ; xbmc.log("dhrelay: stopping service if running: " + cmd, level=xbmc.LOGDEBUG); p = subprocess.Popen(cmd, stdout=subprocess.PIPE,stderr=subprocess.PIPE, shell=True); output, errors = p.communicate(); xbmc.log("dhcrelay s out: " + str(output), level=xbmc.LOGDEBUG); xbmc.log("dhcrelay e out: " + str(errors), xbmc.LOGERROR if errors else xbmc.LOGDEBUG); checkDirExistence(); checkConfigFileExistence(); sutils.addExecPermissions(execDir, True); startService(); while(not xbmc.abortRequested): xbmc.sleep(250); stopService();