Skip to content
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 utils/watchcat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=watchcat
PKG_VERSION:=1
PKG_RELEASE:=25
PKG_RELEASE:=26

PKG_MAINTAINER:=Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>, Dharmik Parmar <dharmikparmar2004@yahoo.com>
PKG_LICENSE:=GPL-2.0
Expand Down
2 changes: 2 additions & 0 deletions utils/watchcat/files/watchcat.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ config watchcat
# For restart_iface and run_script, start a fresh failure window after
# each recovery action finishes before allowing another restart.
# option reset_failure_timer '1'
# 'enabled' allows disabling individual watchcat instances without removing them, default 1
# option enabled '1'
3 changes: 3 additions & 0 deletions utils/watchcat/files/watchcat.init
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ time_to_seconds() {

config_watchcat() {
# Read config
config_get_bool enabled "$1" enabled 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (optional, cosmetic): every other default in this function is quoted (config_get_bool unlockbands "$1" unlockbands "0", config_get period "$1" period "120"); this one is bare. The option name and the config_get_bool ... 1 fallback otherwise match the in-tree convention (e.g. uhttpd.init:117, trelay.init:7), so this is purely about matching the surrounding lines.

Suggested change
config_get_bool enabled "$1" enabled 1
config_get_bool enabled "$1" enabled "1"

Generated by Claude Code

[ "$enabled" -eq 1 ] || return 0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The early return itself is correct: config_get_bool normalises to 0/1 (or falls back to the default for garbage input), so the -eq comparison can't blow up on a hand-edited value, and since start_service re-declares the whole instance set, procd_close_service "set" tears down an instance that stops being declared — so flipping enabled to 0 and reloading does stop the running instance.

Pre-existing, not introduced here, but adjacent enough to be worth mentioning while this function is open: error and warn are plain globals that are never cleared between sections. append_string "error" at watchcat.init:58 accumulates into them, and the [ -n "$error" ] guard at watchcat.init:95-99 returns early, so with two or more config watchcat sections a validation failure in the first one silently suppresses every later section too (and re-logs the first section's message under each subsequent section name). Clearing them at the top of config_watchcat would fix it. Entirely optional for this PR — happy to see it as a separate change.


Generated by Claude Code


config_get period "$1" period "120"
config_get mode "$1" mode "ping_reboot"
config_get pinghosts "$1" pinghosts "8.8.8.8"
Expand Down