Improved systemd example service file
authorKarl O. Pinc <kop@karlpinc.com>
Tue, 3 Sep 2024 16:36:39 +0000 (11:36 -0500)
committerKarl O. Pinc <kop@karlpinc.com>
Tue, 3 Sep 2024 16:36:39 +0000 (11:36 -0500)
examples/etc/systemd/system/pgwui_server.service

index e4b05d20dceb83a13992023d005b48ff4b70454b..8a25f1088be0313b72122d77095ba9541706e1b9 100644 (file)
 # 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