Systemd script for Debian 9 or 10, with postgresql 11 or not.

This commit is contained in:
Emmanuel Viennet 2021-05-28 22:24:37 +02:00
parent 2ee1a386b9
commit c3e5a5d188
4 changed files with 18 additions and 10 deletions

View File

@ -34,9 +34,11 @@ export POSTGRES_USER=www-data
if [ "${debian_version}" = "10" ]
then
PSQL=/usr/lib/postgresql/11/bin/psql
export POSTGRES_SERVICE="postgresql@11-main.service"
elif [ "${debian_version}" = "9" ]
then
PSQL=/usr/lib/postgresql/9.6/bin/psql
export POSTGRES_SERVICE="postgresql"
elif [ "${debian_version}" = "8" ]
then
PSQL=/usr/lib/postgresql/9.4/bin/psql

View File

@ -8,7 +8,13 @@ source utils.sh
check_uid_root $0
echo 'Installation du demarrage automatique de ScoDoc (systemd)'
cp $SCODOC_DIR/config/etc/scodoc.service /etc/systemd/system
# La variable POSTGRES_SERVICE doit être positionnée dans config.sh
# suivant la version de Debian et de postgresql
[ -z "${POSTGRES_SERVICE}" ] && die "incompatible Debian version"
cat "$SCODOC_DIR/config/etc/scodoc.service" | sed 's/{{postgresql}}/'"${POSTGRES_SERVICE}"'/g' > /etc/systemd/system/scodoc.service
systemctl enable scodoc.service
echo "A partir de maintenant, utiliser"

View File

@ -1,13 +1,15 @@
# ScoDoc7 service
# Zope based
# Depends on postgresql
# => is restarted when postgresql restarts
# Depends on {{postgresql}} (replaced by installation script by
# postgresql@11-main.service on Debian 10
# postgresql on Debian <= 9
# => is restarted when {{postgresql}} restarts
#
[Unit]
Description=ScoDoc 7 service
After=network.target postgresql
Requires=postgresql
PartOf=postgresql
After=network.target {{postgresql}}
Requires={{postgresql}}
PartOf={{postgresql}}
StartLimitIntervalSec=0
[Service]
@ -21,4 +23,4 @@ ExecStop=/opt/scodoc/bin/zopectl stop
ExecReload=/opt/scodoc/bin/zopectl restart
[Install]
WantedBy=postgresql
WantedBy={{postgresql}}

View File

@ -220,9 +220,7 @@ read ans
if [ "$(norm_ans "$ans")" != 'N' ]
then
# ScoDoc 7.19+ uses systemd
echo 'Installation du demarrage automatique de ScoDoc (systemd)'
cp $SCODOC_DIR/config/etc/scodoc.service /etc/systemd/system
systemctl enable scodoc.service
$SCODOC_DIR/config/configure_systemd.sh
fi