From a9ff9d66a567481d4bb1a9276b7c74bd3c85cad7 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Fri, 27 Jun 2025 12:43:51 +0200 Subject: [PATCH] add delay as argument to start_frappy --- cfg/linse-fs.cfg | 1 - install.py | 2 +- start_frappy | 18 ++++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cfg/linse-fs.cfg b/cfg/linse-fs.cfg index dc3a7a8..3711a44 100644 --- a/cfg/linse-fs.cfg +++ b/cfg/linse-fs.cfg @@ -6,5 +6,4 @@ MAC=b8:27:eb:33:2e:7a version=1 [FRAPPY] -port=5000 cfg=fs diff --git a/install.py b/install.py index 037979e..f99ccb8 100755 --- a/install.py +++ b/install.py @@ -132,7 +132,7 @@ Description = Running frappy server [Service] Type=simple 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] WantedBy = default.target diff --git a/start_frappy b/start_frappy index bd9cd77..3538f99 100755 --- a/start_frappy +++ b/start_frappy @@ -1,18 +1,20 @@ #!/usr/bin/env python +import sys import os import time -from pathlib import Path from utils import BoxInfo box = BoxInfo() def start_frappy(cfg, port=None): - # os.chdir(Path('~/frappy').expanduser()) - if port is None: - portarg = '' - else: - portarg = f'-p {port} ' - os.system(f"{str(Path('~').expanduser() / 'frappy/bin/frappy-server')} {portarg}{cfg}") + cmd = ['/home/l_samenv/frappy/bin/frappy-server'] + if port: + cmd.append('-p') + cmd.append(str(port)) + cmd.append(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'))