1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Added POST-CMD support

This commit is contained in:
Adolfo Gómez García 2017-06-01 12:25:48 +02:00
parent 16d458bb69
commit 808c715710

View File

@ -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 *
# *********************