From fa08826bfffba7846946f4aa762f0fac1ceec9df Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 1 Apr 2026 10:10:42 +0200 Subject: [PATCH] check_cert_for_service.sh: some minor changes.. --- check_cert_for_service.sh | 57 +++++++++++++-------------------------- 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/check_cert_for_service.sh b/check_cert_for_service.sh index 44d23ff..7bdc489 100755 --- a/check_cert_for_service.sh +++ b/check_cert_for_service.sh @@ -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