Improve systemd settings for slapd (#933)

This commit is contained in:
Alexandre Aubin 2020-04-17 14:40:53 +02:00 committed by GitHub
parent 7cfd553c3f
commit 7061c4c3fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 0 deletions

View file

@ -63,6 +63,9 @@ do_pre_regen() {
cp -a ldap.conf slapd.conf "$ldap_dir"
cp -a sudo.schema mailserver.schema yunohost.schema "$schema_dir"
mkdir -p ${pending_dir}/etc/systemd/system/slapd.service.d/
cp systemd-override.conf ${pending_dir}/etc/systemd/system/slapd.service.d/ynh-override.conf
install -D -m 644 slapd.default "${pending_dir}/etc/default/slapd"
}
@ -83,6 +86,13 @@ do_post_regen() {
chmod o-rwx /etc/yunohost/certs/yunohost.org/
chmod -R g+rx /etc/yunohost/certs/yunohost.org/
# If we changed the systemd ynh-override conf
if echo "$regen_conf_files" | sed 's/,/\n/g' | grep -q "^/etc/systemd/system/slapd.service.d/ynh-override.conf$"
then
systemctl daemon-reload
systemctl restart slapd
fi
[ -z "$regen_conf_files" ] && exit 0
# check the slapd config file at first

View file

@ -0,0 +1,9 @@
[Service]
# Prevent slapd from getting killed by oom reaper as much as possible
OOMScoreAdjust=-1000
# If slapd exited (for instance if got killed) the service should not be
# considered as active anymore...
RemainAfterExit=no
# Automatically restart the service if the service gets down
Restart=always
RestartSec=3