make sure frappy is started on boot
this is a not-so-easy problem of timing change includes a 'start_frappy' script, which gets port and cfg from the box config file. so install does no longer need to be executed when cfg or port is changed
This commit is contained in:
@@ -130,8 +130,9 @@ FRAPPY_SERVICE = """[Unit]
|
||||
Description = Running frappy server
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment=PYTHONPATH=/home/l_samenv/.local/lib/python3.11/site-packages/
|
||||
ExecStart = /usr/bin/python3 /home/l_samenv/frappy/bin/frappy-server %s
|
||||
ExecStart = /home/l_samenv/boxtools/start_frappy
|
||||
|
||||
[Install]
|
||||
WantedBy = default.target
|
||||
@@ -197,11 +198,9 @@ def frappy(cfg=None, port=None, requirements='', **kwds):
|
||||
req = pip_requirements['l_samenv']
|
||||
if requirements:
|
||||
req[cfg] = '\n'.join(requirements.split(','))
|
||||
if port:
|
||||
cfg = '-p %s %s' % (port, cfg)
|
||||
with open('/home/l_samenv/frappy/requirements.txt') as f:
|
||||
req['frappy main'] = f.read()
|
||||
return False, FRAPPY_SERVICE % cfg
|
||||
return False, FRAPPY_SERVICE
|
||||
|
||||
|
||||
def router(firewall=False, **opts):
|
||||
|
||||
18
start_frappy
Executable file
18
start_frappy
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
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}")
|
||||
|
||||
time.sleep(10)
|
||||
start_frappy(**box.read_config('FRAPPY'))
|
||||
@@ -8,6 +8,13 @@ function service_status () {
|
||||
echo ${name} $(systemctl is-active ${name}) $enabled; \
|
||||
done | column -t | grep --color=always '\(disabled\|inactive\|$\)' | nl -bn
|
||||
}
|
||||
function user_service_status () {
|
||||
for name in $@; do \
|
||||
enabled=$(systemctl --user is-enabled ${name} 2> /dev/null) && \
|
||||
echo ${name} $(systemctl --user is-active ${name}) $enabled; \
|
||||
done | column -t | grep --color=always '\(disabled\|inactive\|$\)' | nl -bn
|
||||
}
|
||||
alias current='cat /home/l_samenv/boxtools/current'
|
||||
service_status router frappy display
|
||||
service_status router display
|
||||
user_service_status frappy
|
||||
echo "> current # show currently installed state"
|
||||
|
||||
Reference in New Issue
Block a user