check_cert_for_dovecot.sh: fix error updating cert/key - remove old symlink.
This commit is contained in:
		| @@ -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 | ||||
| # - 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" | ||||
| @@ -234,10 +231,6 @@ if [[ -z "$SYSTEMD_SERVICE" ]] && [[ -z "$SYSV_INIT_SCRIPT" ]] ; then | ||||
| 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 | ||||
| @@ -307,6 +300,10 @@ if ! diff "$(realpath "$cert_installed")" "$(realpath "$cert_newest")" > /dev/nu | ||||
|       if [[ $? -ne 0 ]]; then | ||||
|          _failed=true | ||||
|       fi | ||||
|       rm "$cert_installed" >> $log_file 2>&1 | ||||
|       if [[ $? -ne 0 ]]; then | ||||
|          _failed=true | ||||
|       fi | ||||
|    fi | ||||
|  | ||||
|    if [[ -f "$cert_installed" ]] ; then | ||||
| @@ -348,6 +345,10 @@ if ! diff "$(realpath "$cert_installed")" "$(realpath "$cert_newest")" > /dev/nu | ||||
|          if [[ $? -ne 0 ]]; then | ||||
|             _failed=true | ||||
|          fi | ||||
|          rm "$key_installed" >> $log_file 2>&1 | ||||
|          if [[ $? -ne 0 ]]; then | ||||
|             _failed=true | ||||
|          fi | ||||
|       fi | ||||
|  | ||||
|       if [[ -f "key_installed" ]] ; then | ||||
|   | ||||
		Reference in New Issue
	
	Block a user