From 808c715710dddfb361861d8f97335c018c797a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Thu, 1 Jun 2017 12:25:48 +0200 Subject: [PATCH] Added POST-CMD support --- actors/src/udsactor/windows/UDSActorService.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/actors/src/udsactor/windows/UDSActorService.py b/actors/src/udsactor/windows/UDSActorService.py index cc31386dd..857ae2142 100644 --- a/actors/src/udsactor/windows/UDSActorService.py +++ b/actors/src/udsactor/windows/UDSActorService.py @@ -40,6 +40,7 @@ import win32event # @UnresolvedImport, pylint: disable=import-error import win32com.client # @UnresolvedImport, @UnusedImport, pylint: disable=import-error import pythoncom # @UnresolvedImport, pylint: disable=import-error import servicemanager # @UnresolvedImport, pylint: disable=import-error +import subprocess import os from udsactor import operations @@ -56,6 +57,8 @@ from .SENS import SENSGUID_PUBLISHER from .SENS import PROGID_EventSubscription from .SENS import PROGID_EventSystem +POST_CMD = 'c:\\windows\post-uds.bat' + class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService): ''' @@ -296,6 +299,17 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService): logger.debug('Registered SENS, running main loop') + # Execute script in c:\\windows\\post-uds.bat after interacting with broker, if no reboot is requested ofc + # This will be executed only when machine gets "ready" + try: + if os.path.isfile(POST_CMD): + subprocess.call([POST_CMD, ]) + else: + logger.info('POST file not found & not executed') + except Exception as e: + # Ignore output of execution command + logger.error('Executing post command give') + # ********************* # * Main Service loop * # *********************