I have a bash script which is run via at, I run it like echo "bash /path/to/my/script.sh" | at -M now because I want it to run detached.
When the script is spawned, immediately I see 2 instances (ps), and even after my script completes successfully, another instance just wont terminate. It will get reparented to pid 1 and just keeps doing wait ( strace shows wait4(-1...).
I am not able to figure out why or how this second instance is forked! When I run the script without at, I don't see the second process. Any hints/tips to debug this ?
Thanks.