36 lines
804 B
Bash
36 lines
804 B
Bash
#!/bin/bash
|
|
|
|
source config.conf
|
|
source functions/logging.sh
|
|
source functions/network_check.sh
|
|
source functions/sql_check.sh
|
|
source functions/restart_service.sh
|
|
|
|
# Funktion zur Prüfung der Arbeitszeit
|
|
function is_within_business_hours() {
|
|
current_hour=$(date +%H)
|
|
if (( current_hour >= 7 && current_hour < 18 )); then
|
|
return 0 # True
|
|
else
|
|
return 1 # False
|
|
fi
|
|
}
|
|
|
|
# Hauptscript
|
|
function main() {
|
|
log_info "Starting VPN monitoring script."
|
|
|
|
if is_within_business_hours; then
|
|
log_info "Within business hours. Running network check."
|
|
check_network_traffic
|
|
else
|
|
log_info "Outside business hours. Running SQL activity check."
|
|
check_sql_activity
|
|
fi
|
|
|
|
log_info "VPN monitoring script completed successfully."
|
|
exit 0
|
|
}
|
|
|
|
main
|