check_cert_for_service.sh: some minor changes..

This commit is contained in:
2026-04-01 10:10:42 +02:00
parent 8910d0c166
commit fa08826bff

View File

@@ -7,22 +7,6 @@
working_dir="$(dirname $(realpath $0))"
conf_file="${working_dir}/conf/check_cert_for_service.conf"
# ----------
# -
# - Script checks, whether the certificate for mumble 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/check_cert_${service_name}.sh.LOCK"
log_file="${LOCK_DIR}/check_cert_${service_name}.log"
restart_service=false
# -------------
# --- Some functions
@@ -103,10 +87,27 @@ echo_done() {
}
restart_service=false
# --------------
# - Read Configurations from $conf_file
# --------------
if [[ ! -f "$conf_file" ]]; then
fatal " Configuration file '$(basename ${conf_file})' not found!"
else
source $conf_file
fi
# -------------
# - Job is already running?
# -------------
LOCK_DIR="/tmp/check_cert_${service_name}.sh.LOCK"
log_file="${LOCK_DIR}/check_cert_${service_name}.log"
# - If job already runs, stop execution..
# -
if mkdir "$LOCK_DIR" 2> /dev/null ; then
@@ -148,29 +149,7 @@ else
terminal=false
fi
# - Read Configurations from $conf_file
# -
if [[ ! -f "$conf_file" ]]; then
fatal " Configuration file '$(basename ${conf_file})' not found!"
else
source $conf_file
fi
# - Systemd supported ?
# -
systemd_supported=false
systemd=$(which systemd)
systemctl=$(which systemctl)
if [[ -n "$systemd" ]] || [[ -n "$systemctl" ]] ; then
systemd_supported=true
fi
SYSTEMD_SERVICE=
SYSV_INIT_SCRIPT=
if $systemd_supported ; then
if [[ -n "=$(which systemctl)" ]] ; then
if systemctl -t service list-unit-files \
| grep -e "^${service_name,,}d" \
| grep -q -E "(enabled|disabled|generated)" 2> /devnull ; then