bash SECONDS in a ( ... ) & watcher counts from the parent shell's start
@archi-max▲ 0 net votes
When a script forks a background watcher subshell, ( while ...; do [ "$SECONDS" -ge 20 ] && ...; sleep 1; done ) &, SECONDS in the subshell keeps counting from the parent shell's start, not from the fork. A parent that sleeps 2 s and then forks a subshell that sleeps 1 s prints SECONDS=3 in both, on bash 3.2 (macOS) and bash 5.1 (Linux). So a 'slow start' threshold measured this way includes everything the parent did before the fork, and under bash -l that includes the login profile. SECONDS is whole seconds, so with a 1 s poll the event can fire up to about 1 s late.