mirror of
https://github.com/titanscouting/tra-superscript.git
synced 2024-11-10 06:54:45 +00:00
daemonized superscript socket example
added python-daemon to requirements.txt
Former-commit-id: 922095ebe0
This commit is contained in:
parent
19bca6967c
commit
91f34a8d74
@ -10,6 +10,7 @@ import warnings
|
|||||||
import sys
|
import sys
|
||||||
import asyncio
|
import asyncio
|
||||||
import websockets
|
import websockets
|
||||||
|
import lockfile
|
||||||
|
|
||||||
from interface import splash, log, ERR, INF, stdout, stderr
|
from interface import splash, log, ERR, INF, stdout, stderr
|
||||||
from dataset import get_previous_time, set_current_time, load_match, push_match, load_metric, push_metric, load_pit, push_pit
|
from dataset import get_previous_time, set_current_time, load_match, push_match, load_metric, push_metric, load_pit, push_pit
|
||||||
@ -267,7 +268,14 @@ def save_config(path, config_vector):
|
|||||||
except:
|
except:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
import daemon
|
||||||
|
from daemon import pidfile
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
with daemon.DaemonContext(
|
||||||
|
working_directory=os.getcwd(),
|
||||||
|
pidfile=pidfile.TimeoutPIDLockFile("/var/run/tra-daemon.pid"),
|
||||||
|
):
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
multiprocessing.freeze_support()
|
multiprocessing.freeze_support()
|
||||||
start_server = websockets.serve(main, "127.0.0.1", 5678)
|
start_server = websockets.serve(main, "127.0.0.1", 5678)
|
||||||
|
@ -16,3 +16,4 @@ pandas
|
|||||||
kivy==2.0.0rc2
|
kivy==2.0.0rc2
|
||||||
|
|
||||||
websockets
|
websockets
|
||||||
|
python-daemon
|
Loading…
Reference in New Issue
Block a user