From e008ae11f59523b4c383fb2de05ffbf51b5af21a Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 8 Jul 2025 08:27:23 +0200 Subject: [PATCH] command 'frappy cli' does now connect to the configured frappy and not scanned frappy servers --- install.py | 3 ++- start_frappy | 13 ++++++++++--- to_home/.bash_profile | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/install.py b/install.py index f279dee..dd9914f 100755 --- a/install.py +++ b/install.py @@ -130,11 +130,12 @@ WantedBy = multi-user.target FRAPPY_SERVICE = """[Unit] Description = Running frappy server +After=waitboot.service [Service] Type=simple Environment=PYTHONPATH=/home/l_samenv/.local/lib/python3.11/site-packages/ -ExecStart = /home/l_samenv/boxtools/start_frappy 10 +ExecStart = /home/l_samenv/boxtools/start_frappy [Install] WantedBy = default.target diff --git a/start_frappy b/start_frappy index caab3e9..00c4fd3 100755 --- a/start_frappy +++ b/start_frappy @@ -5,6 +5,7 @@ import time from frappy.lib import generalConfig from frappy.logging import logger from frappy.server import Server +from frappy.client.interactive import init, interact from utils import BoxInfo box = BoxInfo() @@ -15,9 +16,15 @@ def main(cfg, port=None, **_): srv = Server(cfg, logger.log, cfgfiles=None, interface=port) srv.run() -if len(sys.argv) > 1: - time.sleep(int(sys.argv[1])) +def cli(cfg, port, **_): + init(f'localhost:{port}') + interact() -main(**box.read_config('FRAPPY')) +cfg = box.read_config('FRAPPY') + +if sys.argv[1:2] == ['cli']: + cli(**cfg) +else: + main(**cfg) diff --git a/to_home/.bash_profile b/to_home/.bash_profile index b6fb79e..6701181 100644 --- a/to_home/.bash_profile +++ b/to_home/.bash_profile @@ -13,7 +13,7 @@ frappy() { if [[ -z "$1" ]]; then echo "Usage: frappy status|start|stop|restart|cli" elif [[ "$1" == "cli" ]]; then - ~/frappy/bin/frappy-cli + ~/boxtools/start_frappy cli else systemctl --user $1 frappy fi