# 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