I have a script that updates domain blocks for coredns and restarts coredns once done. If I invoke the script from the CLI, it completes quickly and exits. If I use the /usr/bin/timeout to invoke it, it hangs until the timeout is reached and exits with status 124. If I invoke it with gtimeout (gnu coreutils' timeout), it completes the same as if I invoke it directly.
I suspect it has something to do with the command perhaps redirecting stdin / stdout, but can't seem to find the culprit. At the end of the main script, I added a logger statement that says it reached the end. That log is written to syslog, but the script continues to hang until the timeout duration.
I tried using /bin/sh instead of /usr/bin/env bash, but that also had no impact.
I suspect it has something to do with the command perhaps redirecting stdin / stdout, but can't seem to find the culprit. At the end of the main script, I added a logger statement that says it reached the end. That log is written to syslog, but the script continues to hang until the timeout duration.
I tried using /bin/sh instead of /usr/bin/env bash, but that also had no impact.