add delay as argument to start_frappy

This commit is contained in:
2025-06-27 12:43:51 +02:00
parent 86eef4e0f6
commit a9ff9d66a5
3 changed files with 11 additions and 10 deletions

View File

@ -6,5 +6,4 @@ MAC=b8:27:eb:33:2e:7a
version=1 version=1
[FRAPPY] [FRAPPY]
port=5000
cfg=fs cfg=fs

View File

@ -132,7 +132,7 @@ Description = Running frappy server
[Service] [Service]
Type=simple Type=simple
Environment=PYTHONPATH=/home/l_samenv/.local/lib/python3.11/site-packages/ Environment=PYTHONPATH=/home/l_samenv/.local/lib/python3.11/site-packages/
ExecStart = /home/l_samenv/boxtools/start_frappy ExecStart = /home/l_samenv/boxtools/start_frappy 10
[Install] [Install]
WantedBy = default.target WantedBy = default.target

View File

@ -1,18 +1,20 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys
import os import os
import time import time
from pathlib import Path
from utils import BoxInfo from utils import BoxInfo
box = BoxInfo() box = BoxInfo()
def start_frappy(cfg, port=None): def start_frappy(cfg, port=None):
# os.chdir(Path('~/frappy').expanduser()) cmd = ['/home/l_samenv/frappy/bin/frappy-server']
if port is None: if port:
portarg = '' cmd.append('-p')
else: cmd.append(str(port))
portarg = f'-p {port} ' cmd.append(cfg)
os.system(f"{str(Path('~').expanduser() / 'frappy/bin/frappy-server')} {portarg}{cfg}") os.system(' '.join(cmd))
if len(sys.argv) > 1:
time.sleep(int(sys.argv[1]))
time.sleep(10)
start_frappy(**box.read_config('FRAPPY')) start_frappy(**box.read_config('FRAPPY'))