Commit 844a88ba authored by nextime's avatar nextime

Fix duplicate check_restart_limits() functions in watchdogs

- Removed duplicate function definitions causing bash arithmetic errors
- Kept the more complete check_restart_limits() function with awk timestamp parsing
- Fixed both wssshd and wssshc watchdog scripts
- Eliminates 'integer expression expected' errors
parent 7c51589c
...@@ -169,26 +169,6 @@ stop_daemon() { ...@@ -169,26 +169,6 @@ stop_daemon() {
fi fi
} }
# Function to check restart limits
check_restart_limits() {
local current_time=$(date +%s)
local restart_count=0
local window_start=$((current_time - RESTART_WINDOW))
# Simple restart counting - just count total successful starts
if [ -f "$LOG_FILE" ]; then
restart_count=$(grep -c "started successfully" "$LOG_FILE" 2>/dev/null || echo "0")
fi
# For now, disable restart limiting to avoid complex parsing issues
# This can be re-enabled with a simpler implementation later
if [ "$restart_count" -ge "$MAX_RESTARTS" ]; then
log_message "Too many restarts ($restart_count) detected. Continuing anyway."
# return 1 # Disabled for now
fi
return 0
}
# Function to cleanup on exit # Function to cleanup on exit
cleanup() { cleanup() {
......
...@@ -164,26 +164,6 @@ stop_daemon() { ...@@ -164,26 +164,6 @@ stop_daemon() {
fi fi
} }
# Function to check restart limits
check_restart_limits() {
local current_time=$(date +%s)
local restart_count=0
local window_start=$((current_time - RESTART_WINDOW))
# Simple restart counting - just count total successful starts
if [ -f "$LOG_FILE" ]; then
restart_count=$(grep -c "started successfully" "$LOG_FILE" 2>/dev/null || echo "0")
fi
# For now, disable restart limiting to avoid complex parsing issues
# This can be re-enabled with a simpler implementation later
if [ "$restart_count" -ge "$MAX_RESTARTS" ]; then
log_message "Too many restarts ($restart_count) detected. Continuing anyway."
# return 1 # Disabled for now
fi
return 0
}
# Function to cleanup on exit # Function to cleanup on exit
cleanup() { cleanup() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment