Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix typo #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ How often should be pinged?

Sets interval in seconds, how long it should wait for next connection check.

restart_treshold: 10
restart_threshold: 10

The last option is a delay, in seconds, between shutdown WiFi Interface and bring it up again.

Expand Down
11 changes: 7 additions & 4 deletions libs/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,15 @@ function setup_env {
fi
SONAR_PING_COUNT="$(get_param sonar count)"
SONAR_CHECK_INTERVAL="$(get_param sonar interval)"
SONAR_RESTART_TRESHOLD="$(get_param sonar restart_treshold)"
SONAR_RESTART_THRESHOLD="$(get_param sonar restart_threshold)"
if [[ -z "${SONAR_RESTART_THRESHOLD}" ]]; then
SONAR_RESTART_THRESHOLD="$(get_param sonar restart_treshold)"
fi
SONAR_DEBUG_LOG="$(get_param sonar debug_log)"
declare -r SONAR_TARGET
declare -r SONAR_PING_COUNT
declare -r SONAR_CHECK_INTERVAL
declare -r SONAR_RESTART_TRESHOLD
declare -r SONAR_RESTART_THRESHOLD
declare -r SONAR_DEBUG_LOG

# Set vars only once!
Expand Down Expand Up @@ -216,8 +219,8 @@ function keepalive {
fi
else
log_msg "Connection lost, ${SONAR_TARGET} not reachable!"
log_msg "Restarting network in ${SONAR_RESTART_TRESHOLD:-10} seconds."
sleep "${SONAR_RESTART_TRESHOLD:-10}"
log_msg "Restarting network in ${SONAR_RESTART_THRESHOLD:-10} seconds."
sleep "${SONAR_RESTART_THRESHOLD:-10}"
until ping -c1 "${SONAR_TARGET}" > /dev/null; do
used_retries=$((used_retries+1))
retry_count=$((retry_count+1))
Expand Down
2 changes: 1 addition & 1 deletion resources/sonar.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ persistant_log: false # If true logs in /var/log/sonar.log, false logs to
target: auto # IP Address, URL or auto as ping target
count: 3 # How often should be pinged?
interval: 60 # Ping again after X seconds
restart_treshold: 10 # If failed, restart WiFi after X seconds
restart_threshold: 10 # If failed, restart WiFi after X seconds