diff --git a/functions/restart_service.sh b/functions/restart_service.sh index 4b37cef..e5c6147 100644 --- a/functions/restart_service.sh +++ b/functions/restart_service.sh @@ -21,4 +21,5 @@ function restart_service() { fi log_info "Service $SERVICE_NAME successfully restarted and verified." -} + return 0 # Erfolg +} \ No newline at end of file diff --git a/functions/sql_check.sh b/functions/sql_check.sh index c646813..8be4873 100644 --- a/functions/sql_check.sh +++ b/functions/sql_check.sh @@ -19,7 +19,9 @@ function check_sql_activity() { if (( (now - last_order_epoch) > 3600 && (now - last_bsi_epoch) > 7200 )); then log_critical "SQL activity check failed. No activity in expected timeframes." restart_service + exit 2 # Fehler, Dienst wurde neu gestartet else log_info "SQL activity is within acceptable limits." + exit 0 # Erfolg fi -} +} \ No newline at end of file diff --git a/vpn_monitor.sh b/vpn_monitor.sh index 0009899..e300df7 100644 --- a/vpn_monitor.sh +++ b/vpn_monitor.sh @@ -1,6 +1,5 @@ #!/bin/bash -# Source Konfigurations- und Modul-Dateien source config.conf source functions/logging.sh source functions/network_check.sh @@ -17,7 +16,7 @@ function is_within_business_hours() { fi } -# Hauptlogik +# Hauptscript function main() { log_info "Starting VPN monitoring script." @@ -28,6 +27,9 @@ function main() { log_info "Outside business hours. Running SQL activity check." check_sql_activity fi + + log_info "VPN monitoring script completed successfully." + exit 0 } main