check_cert_for_dovecot.sh: fix error updating cert/key - remove old symlink.

This commit is contained in:
Christoph 2020-08-14 23:58:38 +02:00
parent e91946ba08
commit dbe86ff8e4

View File

@ -11,13 +11,10 @@ conf_file="${working_dir}/conf/${script_name%%.*}.conf"
# ---------- # ----------
# - # -
# - Script checks, whether the certificate for mumble services are up to date. If # - Script checks, whether the certificate/key for dovecot services are up to date. If
# - newer versions than the installed one found, script changes the installed # - newer versions than the installed one found, script changes the installed
# - key/cert to the latest version. # - key/cert to the latest version.
# - # -
# - Note !!
# - This script is very special to the server environment of machine 'o13-il.oopen.de'
# -
# ---------- # ----------
LOCK_DIR="/tmp/${script_name%%.*}.LOCK" LOCK_DIR="/tmp/${script_name%%.*}.LOCK"
@ -234,10 +231,6 @@ if [[ -z "$SYSTEMD_SERVICE" ]] && [[ -z "$SYSV_INIT_SCRIPT" ]] ; then
fi fi
#echo "SYSTEMD_SERVICE: $SYSTEMD_SERVICE"
#echo "SYSV_INIT_SCRIPT: $SYSV_INIT_SCRIPT"
#clean_up 0
# ------------- # -------------
# - Don't run script, if any give path for cert/key does not exists # - Don't run script, if any give path for cert/key does not exists
@ -307,6 +300,10 @@ if ! diff "$(realpath "$cert_installed")" "$(realpath "$cert_newest")" > /dev/nu
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
_failed=true _failed=true
fi fi
rm "$cert_installed" >> $log_file 2>&1
if [[ $? -ne 0 ]]; then
_failed=true
fi
fi fi
if [[ -f "$cert_installed" ]] ; then if [[ -f "$cert_installed" ]] ; then
@ -348,6 +345,10 @@ if ! diff "$(realpath "$cert_installed")" "$(realpath "$cert_newest")" > /dev/nu
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
_failed=true _failed=true
fi fi
rm "$key_installed" >> $log_file 2>&1
if [[ $? -ne 0 ]]; then
_failed=true
fi
fi fi
if [[ -f "key_installed" ]] ; then if [[ -f "key_installed" ]] ; then