From ca96cf644ebb5897433fa34a48a5702543533229 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 3 Sep 2024 11:36:39 -0500 Subject: [PATCH] Improved systemd example service file --- examples/etc/systemd/system/pgwui_server.service | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/etc/systemd/system/pgwui_server.service b/examples/etc/systemd/system/pgwui_server.service index e4b05d2..8a25f10 100644 --- a/examples/etc/systemd/system/pgwui_server.service +++ b/examples/etc/systemd/system/pgwui_server.service @@ -17,13 +17,23 @@ # environment in which PGWUI_Server is installed. [Unit] -Description=PGWUI_Server web server +Description=PGWUI_Server web server, a PostgreSQL Web User Interface [Service] Type=simple +PIDFile = /run/pgwui_server/pgwui_server.pid User=www-data -ExecStart=/usr/local/lib/pgwui/venv/bin/python -W 'ignore:The psycopg2 wheel package will be renamed from release 2.8::psycopg2' /usr/local/lib/pgwui/venv/bin/pserve /etc/pgwui.ini +Group = www-data +WorkingDirectory = /var/www +ExecStartPre = +/bin/mkdir /run/pgwui_server +ExecStartPre = +/bin/chown -R www-data:www-data /run/pgwui_server +ExecStart=/usr/local/lib/pgwui/venv/bin/pserve /etc/pgwui.ini +ExecReload = /bin/kill -s HUP $MAINPID +ExecStop = /bin/kill -s TERM $MAINPID +ExecStopPost = +/bin/rm -rf /run/pgwui_server +PrivateTmp = true [Install] +WantedBy = multi-user.target WantedBy=nginx.service -- 2.34.1