systemd service
All checks were successful
Deploy powerbar.ti Frontend Portal / Deploy-Tinance2-Frontend-Portal-Production (push) Successful in 36s

This commit is contained in:
Matthew Frost 2024-02-02 12:34:50 +01:00
parent 2799621420
commit d6194534f5
2 changed files with 19 additions and 14 deletions

19
powerbar.service Normal file
View file

@ -0,0 +1,19 @@
[Unit]
Description=Powerbar daemon
After=network.target
[Service]
User=powerbar
Group=powerbar
Environment="VIRTUAL_ENV=/opt/powerbar/venv"
Environment="PATH=/opt/powerbar/venv/bin:/usr/local/bin:/usr/bin:/bin"
ExecStart=/opt/powerbar/venv/bin/gunicorn app:app \
-k geventwebsocket.gunicorn.workers.GeventWebSocketWorker \
--name powerbar --workers 1 \
--max-requests 400 --max-requests-jitter 50 \
--log-level=info --bind=0.0.0.0:5000
WorkingDirectory=/opt/powerbar/ti-powerbar
Restart=on-failure
[Install]
WantedBy=multi-user.target

View file

@ -1,14 +0,0 @@
import telnetlib
def check_input_error():
tn = telnetlib.Telnet("10.209.10.111", 2168)
tn.write("/\r\n".encode('ascii'))
for _ in range(3):
output = tn.read_until(b"Input error", timeout=3).decode('ascii')
print(output)
if "Input error" in output:
return True
return False
result = check_input_error()
print(result)