Always run only one instance of PKC
This commit is contained in:
parent
983fd168bb
commit
2079b3c554
1 changed files with 11 additions and 2 deletions
13
service.py
13
service.py
|
@ -334,14 +334,23 @@ class Service():
|
||||||
downloadutils.DownloadUtils().stopSession()
|
downloadutils.DownloadUtils().stopSession()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
window('plex_service_started', clear=True)
|
||||||
log.warn("======== STOP %s ========" % v.ADDON_NAME)
|
log.warn("======== STOP %s ========" % v.ADDON_NAME)
|
||||||
|
|
||||||
|
# Safety net - Kody starts PKC twice upon first installation!
|
||||||
|
if window('plex_service_started') == 'true':
|
||||||
|
exit = True
|
||||||
|
else:
|
||||||
|
window('plex_service_started', value='true')
|
||||||
|
exit = False
|
||||||
|
|
||||||
# Delay option
|
# Delay option
|
||||||
delay = int(settings('startupDelay'))
|
delay = int(settings('startupDelay'))
|
||||||
|
|
||||||
log.warn("Delaying Plex startup by: %s sec..." % delay)
|
log.warn("Delaying Plex startup by: %s sec..." % delay)
|
||||||
if delay and Monitor().waitForAbort(delay):
|
if exit:
|
||||||
|
log.error('PKC service.py already started - exiting this instance')
|
||||||
|
elif delay and Monitor().waitForAbort(delay):
|
||||||
# Start the service
|
# Start the service
|
||||||
log.warn("Abort requested while waiting. PKC not started.")
|
log.warn("Abort requested while waiting. PKC not started.")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue