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

watchcat: allow define custom timeout #25173

Open
kumy opened this issue Oct 20, 2024 · 1 comment · May be fixed by #25174
Open

watchcat: allow define custom timeout #25173

kumy opened this issue Oct 20, 2024 · 1 comment · May be fixed by #25174

Comments

@kumy
Copy link

kumy commented Oct 20, 2024

Maintainer: @neheb, @jtkohl
Environment: openwrt-23.05

Description:
Could we please have a way to define our own value for the ping timeout 🙏

The actual implementation uses ping without specifying the -W parameter, which defaults to 10s

if [ "$iface" != "" ]; then
ping_result="$(
ping $ping_family -I "$iface" -s "$ping_size" -c 1 "$host" &> /dev/null
echo $?
)"
else
ping_result="$(
ping $ping_family -s "$ping_size" -c 1 "$host" &> /dev/null
echo $?
)"

ping --help
[...]
	-W SEC		Seconds to wait for the first response (default 10)

Thanks a lot :)

EDIT: first draft PR #25174

@kumy
Copy link
Author

kumy commented Oct 20, 2024

my actual local patch is

--- /tmp/watchcat.sh.orig	2024-10-20 09:56:16.716946280 +0200
+++ /tmp/watchcat.sh.new	2024-10-20 09:55:57.417045742 +0200
@@ -137,12 +137,12 @@
 		for host in $ping_hosts; do
 			if [ "$iface" != "" ]; then
 				ping_result="$(
-					ping $ping_family -I "$iface" -s "$ping_size" -c 1 "$host" &> /dev/null
+					ping $ping_family -I "$iface" -s "$ping_size" -c 1 -W 1 "$host" &> /dev/null
 					echo $?
 				)"
 			else
 				ping_result="$(
-					ping $ping_family -s "$ping_size" -c 1 "$host" &> /dev/null
+					ping $ping_family -s "$ping_size" -c 1 -W 1 "$host" &> /dev/null
 					echo $?
 				)"
 			fi
@@ -218,12 +218,12 @@
 		for host in $ping_hosts; do
 			if [ "$iface" != "" ]; then
 				ping_result="$(
-					ping $ping_family -I "$iface" -s "$ping_size" -c 1 "$host" &> /dev/null
+					ping $ping_family -I "$iface" -s "$ping_size" -c 1 -W 1 "$host" &> /dev/null
 					echo $?
 				)"
 			else
 				ping_result="$(
-					ping $ping_family -s "$ping_size" -c 1 "$host" &> /dev/null
+					ping $ping_family -s "$ping_size" -c 1 -W 1 "$host" &> /dev/null
 					echo $?
 				)"
 			fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant