-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaemon.py
More file actions
executable file
·32 lines (25 loc) · 878 Bytes
/
daemon.py
File metadata and controls
executable file
·32 lines (25 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python2
import os
import subprocess
import sys
import tempfile
from Logger import logger
BASE_COMMAND = "/usr/bin/xinit /usr/bin/dbus-launch --exit-with-session %s -- :0 -nolisten tcp vt7"
try:
logger.debug("Starting ThinLauncher Daemon")
while True:
logger.debug("Launching ThinLauncher GUI")
returnCode = subprocess.call(BASE_COMMAND%"/home/kodi/ThinLauncher/main.py", shell=True)
if returnCode != 0:
sys.exit(returnCode)
temporaryFile = os.path.join(tempfile.gettempdir(), 'thinlauncher.tmp')
if os.path.exists(temporaryFile):
ff = open(temporaryFile, 'rb')
command = ff.read()
ff.close()
os.remove(temporaryFile)
subprocess.call(command, shell=True)
else:
sys.exit(0)
except Exception as e:
logger.error(str(e))