install_update_dovecot.sh: systemd service file is now loacted in '/lib/systemd/system/' directory.
This commit is contained in:
parent
3dbea534e6
commit
dea7e2640f
@ -217,6 +217,8 @@ fi
|
||||
[[ -n "$max_userip_connections" ]] || max_userip_connections=24
|
||||
[[ -n "$auth_mechanisms" ]] || auth_mechanisms="plain login"
|
||||
|
||||
[[ -n "$service_limit_nofile" ]] || service_limit_nofile=524280
|
||||
|
||||
declare -i dovecot_major_version=0
|
||||
declare -i dovecot_minor_version=0
|
||||
declare -i dovecot_patch_level=0
|
||||
@ -866,6 +868,8 @@ else
|
||||
echo -e "$rc_skipped"
|
||||
fi
|
||||
|
||||
blank_line
|
||||
|
||||
echononl "\tRemove dovecot service file if exists.."
|
||||
if [[ -f "/etc/systemd/system/dovecot.service" ]] ; then
|
||||
rm -f "/etc/systemd/system/dovecot.service" > /dev/null 2>&1
|
||||
@ -892,6 +896,21 @@ else
|
||||
echo -e "$rc_skipped"
|
||||
fi
|
||||
|
||||
echononl "\tRemove directory '/etc/systemd/system/dovecot.service.d' if exists.."
|
||||
if [[ -d "/etc/systemd/system/dovecot.service.d" ]] ; then
|
||||
rm -rf "/etc/systemd/system/dovecot.service.d" > /dev/null 2>&1
|
||||
if [[ "$?" -gt 0 ]]; then
|
||||
echo -e "$rc_failed"
|
||||
error "Removing directory '/etc/systemd/system/dovecot.service.d' failed."
|
||||
else
|
||||
echo -e "$rc_done"
|
||||
fi
|
||||
else
|
||||
echo -e "$rc_skipped"
|
||||
fi
|
||||
|
||||
blank_line
|
||||
|
||||
## - Install dovecot
|
||||
## -
|
||||
echononl "\tInstall Dovecot into Folder /usr/local/dovecot-${_version}"
|
||||
@ -2389,37 +2408,43 @@ if $systemd_support; then
|
||||
## - here:
|
||||
## - LimitNOFILE=32768
|
||||
## -
|
||||
echononl "\tAdjust 'LimitNOFILE' at file 'dovecot.service'.."
|
||||
if [[ -f "/etc/systemd/system/dovecot.service" ]] ; then
|
||||
if $(grep -q -o -E "LimitNOFILE\s*=\s*[^[:blank:]]+" /etc/systemd/system/dovecot.service 2> /dev/null ) ; then
|
||||
perl -i -n -p -e "s/(LimitNOFILE\s*=\s*.*)/LimitNOFILE=32768/" /etc/systemd/system/dovecot.service
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo -e "$rc_done"
|
||||
if [[ -f "/lib/systemd/system/dovecot.service" ]] \
|
||||
&& $(grep -q -E "^LimitNOFILE=" /lib/systemd/system/dovecot.service) ; then
|
||||
|
||||
_LimitNOFILE="$(grep -E "^LimitNOFILE=[[:digit:]]+" /lib/systemd/system/dovecot.service | cut -d'=' -f2)"
|
||||
|
||||
adjust_limit_nofile=false
|
||||
|
||||
if [[ $service_limit_nofile -gt _LimitNOFILE ]] ; then
|
||||
|
||||
adjust_limit_nofile=true
|
||||
echononl "\tCreate Directory '/etc/systemd/system/dovecot.service.d'.."
|
||||
if [[ -d "/etc/systemd/system/dovecot.service.d" ]] ; then
|
||||
echo -e "$rc_skipped"
|
||||
else
|
||||
mkdir "/etc/systemd/system/dovecot.service.d" > /dev/null 2>&1
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo -e "$rc_done"
|
||||
else
|
||||
echo -e "$rc_failed"
|
||||
adjust_limit_nofile=false
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -e "$rc_skipped"
|
||||
|
||||
fi
|
||||
|
||||
echononl "\tAdjust 'LimitNOFILE' for 'dovecot.service'.."
|
||||
if ! $adjust_limit_nofile ; then
|
||||
echo -e "$rc_skipped"
|
||||
else
|
||||
cat <<EOF > /etc/systemd/system/dovecot.service.d/set-limit-nofile.conf
|
||||
[Service]
|
||||
LimitNOFILE=$service_limit_nofile
|
||||
EOF
|
||||
echo -e "$rc_done"
|
||||
fi
|
||||
else
|
||||
echo -e "$rc_skipped"
|
||||
fi
|
||||
|
||||
echononl "Adjust 'PIDFile' at file 'dovecot.service'.."
|
||||
if [[ -f "/etc/systemd/system/dovecot.service" ]] ; then
|
||||
if $(grep -q -o -E "^\s*PIDFile\s*=\s*/run/" /etc/systemd/system/dovecot.service 2> /dev/null ) ; then
|
||||
perl -i -n -p -e "s/^(PIDFile\s*=\/var(\/run\/.+))/#\1\nPIDFile=\2/" /etc/systemd/system/dovecot.service
|
||||
if [[ $? -eq 0 ]]; then
|
||||
echo -e "$rc_done"
|
||||
else
|
||||
echo -e "$rc_failed"
|
||||
fi
|
||||
else
|
||||
echo -e "$rc_skipped"
|
||||
fi
|
||||
else
|
||||
echo -e "$rc_skipped"
|
||||
fi
|
||||
|
||||
echononl "\tReload systemd .."
|
||||
systemctl daemon-reload > /dev/null 2>&1
|
||||
|
Loading…
Reference in New Issue
Block a user