Compare commits
6
Commits
7dd09572da
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4beaaa78a5 | ||
|
|
d86b3359ac | ||
|
|
ca20300809 | ||
|
|
b2d47a4cc5 | ||
|
|
f941e1eab7 | ||
|
|
05ec2913c5 |
@@ -167,8 +167,8 @@ Das Skript behandelt potenzielle Fehler folgendermaßen:
|
|||||||
## **Autoren**
|
## **Autoren**
|
||||||
|
|
||||||
- **Dein Name**
|
- **Dein Name**
|
||||||
E-Mail: [[email protected]](mailto:[email protected])
|
E-Mail: [[email protected]](mailto:[email protected])
|
||||||
GitHub: [DeinGitHub](https://github.com/DeinGitHub)
|
GitHub: [no](https://git.admins.tech/no)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -9,7 +9,7 @@ THRESHOLD_INBOUND=0.5
|
|||||||
THRESHOLD_OUTBOUND=0.5
|
THRESHOLD_OUTBOUND=0.5
|
||||||
|
|
||||||
# Messparameter
|
# Messparameter
|
||||||
MEASUREMENT_COUNT=10
|
MEASUREMENT_COUNT=15
|
||||||
INTERVAL=6
|
INTERVAL=6
|
||||||
|
|
||||||
# SQL-Datenbankverbindung
|
# SQL-Datenbankverbindung
|
||||||
@@ -20,7 +20,8 @@ DB_NAME="database"
|
|||||||
# SSH-Verbindung
|
# SSH-Verbindung
|
||||||
SSH_KEY="/path/to/private_key"
|
SSH_KEY="/path/to/private_key"
|
||||||
SSH_USER="user"
|
SSH_USER="user"
|
||||||
SSH_HOST="remote_host"
|
SSH_HOST="127.0.0.1"
|
||||||
|
SSH_PORT="22"
|
||||||
|
|
||||||
# Neuzustartender Dienst
|
# Neuzustartender Dienst
|
||||||
SERVICE_NAME="ipsec.service"
|
SERVICE_NAME="ipsec.service"
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ function restart_service() {
|
|||||||
|
|
||||||
log_info "Attempting to restart service $SERVICE_NAME on $SSH_HOST."
|
log_info "Attempting to restart service $SERVICE_NAME on $SSH_HOST."
|
||||||
|
|
||||||
ssh -i $SSH_KEY $SSH_USER@$SSH_HOST "sudo systemctl restart $SERVICE_NAME"
|
ssh -i $SSH_KEY -p $SSH_PORT $SSH_USER@$SSH_HOST "sudo -n /usr/bin/systemctl restart $SERVICE_NAME"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
log_error "Failed to restart service $SERVICE_NAME on $SSH_HOST."
|
log_error "Failed to restart service $SERVICE_NAME on $SSH_HOST."
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ssh -i $SSH_KEY $SSH_USER@$SSH_HOST "sudo ipsec statusall | grep -i '1 up, 0 connecting'"
|
ssh -i $SSH_KEY -p $SSH_PORT $SSH_USER@$SSH_HOST "sudo -n ipsec statusall | grep -i 'Security Associations (1 up, 0 connecting):'"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
log_critical "Service $SERVICE_NAME not running after restart."
|
log_critical "Service $SERVICE_NAME not running after restart."
|
||||||
exit 2
|
exit 2
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ source "$BASE_DIR/functions/restart_service.sh"
|
|||||||
|
|
||||||
function is_within_business_hours() {
|
function is_within_business_hours() {
|
||||||
current_hour=$(date +%H)
|
current_hour=$(date +%H)
|
||||||
|
current_hour=$((10#$current_hour))
|
||||||
if (( current_hour >= 7 && current_hour < 18 )); then
|
if (( current_hour >= 7 && current_hour < 18 )); then
|
||||||
return 0 # True
|
return 0 # True
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user