Debian: add service and post installation script to create user and group
This commit is contained in:
parent
d79ddc6731
commit
3c14447ef9
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
# Create numerus user and group
|
||||
if ! getent group numerus >/dev/null; then
|
||||
addgroup --system --quiet numerus
|
||||
fi
|
||||
if ! getent passwd numerus >/dev/null; then
|
||||
adduser --quiet \
|
||||
--system \
|
||||
--disabled-login \
|
||||
--no-create-home \
|
||||
--shell /bin/bash \
|
||||
--ingroup numerus \
|
||||
--home /usr/share/numerus \
|
||||
--gecos "Numerus Daemon" \
|
||||
numerus
|
||||
fi
|
||||
|
||||
# Make sure log directory has correct permissions set
|
||||
dpkg-statoverride --list "/var/log/numerus" >/dev/null || \
|
||||
dpkg-statoverride --add --force --quiet --update numerus adm 0750 /var/log/numerus
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=Numerus application server
|
||||
Requires=postgresql.service
|
||||
After=postgresql.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=numerus
|
||||
Group=numerus
|
||||
WorkingDirectory=/usr/share/numerus
|
||||
EnvironmentFile=-/etc/default/numerus
|
||||
ExecStart=/usr/bin/numerus
|
||||
Restart=always
|
||||
StandardOutput=append:/var/log/numerus/access.log
|
||||
StandardError=append:/var/log/numerus/error.log
|
Loading…
Reference in New Issue