help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] How to trap SIGTERM?


From: Peng Yu
Subject: [Help-bash] How to trap SIGTERM?
Date: Fri, 19 Apr 2013 23:27:21 -0500

Hi,

~/linux/test/bash/man/builtin/trap/SIGTERM$ cat main.sh
#!/usr/bin/env bash

echo $$
trap "echo Booh!; exit" SIGTERM
while true
do
  sleep 60
done

I have the above script. I run it and get the process id. Then I use
"kill -SIGTERM pid" to kill it. But the script fails to respond. Does
anybody know how to get the script respond to SIGTERM? Thanks.

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]