I wrote a simple bash script which does nothing but sleeps.
#!/bin/bash
echo "Sleeping..."
sleep 180s
I see two processes running on my system after I run the script:
user 22880 0.0 0.0 12428 1412 pts/28 S+ 20:12 0:00 /bin/bash ./sleep.sh
user 22881 0.0 0.0 7196 356 pts/28 S+ 20:12 0:00 sleep 180s
I give a SIGTERM
to the process with id 22880
by using kill -15 22880
which kills the process. However, after this, I still see the sleep command running which exits after 180 seconds.
user 22881 0.0 0.0 7196 356 pts/28 S 20:12 0:00 sleep 180s
Why does this happen? What do I need to do to not leave the sleep 180s
process running?