summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Burda <contact@sinitax.com>2025-04-24 15:48:57 +0200
committerLouis Burda <contact@sinitax.com>2025-04-24 15:48:57 +0200
commit2341827d7928eb70e68c897f851d8c8b8e8f40f7 (patch)
treeabb3dee78e91d82e56fe3627a514c7fa53e96644
parent42f34eef8d5d7026bfa143f217d2c0924e8d5c30 (diff)
downloadgit-sync-2341827d7928eb70e68c897f851d8c8b8e8f40f7.tar.gz
git-sync-2341827d7928eb70e68c897f851d8c8b8e8f40f7.zip
Fix config monitoring and cleanup
-rwxr-xr-xgit-syncd9
1 files changed, 6 insertions, 3 deletions
diff --git a/git-syncd b/git-syncd
index db1d7a5..8b318a6 100755
--- a/git-syncd
+++ b/git-syncd
@@ -55,8 +55,9 @@ log_prefix() {
git_syncd_watchers=()
kill_watchers() {
for pid in "${git_syncd_watchers}"; do
- kill -9 "$pid"
- timeout 10 wait "$pid" || notify-send "Failed to kill git-syncd watcher"
+ kill -9 "$pid" &>/dev/null
+ waitpid -t 10 "$pid" &>/dev/null
+ kill -0 "$pid" &>/dev/null && notify-send "Failed to kill git-syncd watcher"
done
git_syncd_watchers=()
}
@@ -76,12 +77,14 @@ load_config() {
}
load_config
+trap kill_watchers EXIT
start_watchers
while true; do
- file=$(inotifywait --format "%w%f" -e modify,delete,create "$GIT_SYNCD_CONFIG_DIR" 2>/dev/null)
+ file=$(inotifywait --format "%w%f" -e modify,delete "$GIT_SYNCD_CONFIG")
if [ ! -z "$file" ]; then
mod_path="$(realpath "$file" 2>/dev/null)"
config_path="$(realpath "$GIT_SYNCD_CONFIG" 2>/dev/null)"
+ echo "config $mod_path $config_path"
if [ "$mod_path" = "$config_path" ]; then
kill_watchers
load_config