I have a process running.......i have to catch/trap the signal when the process is being interupted/killed (kill -9 pid) option......
how can i achieve the same thru my process........
let my process is a.sh and it supposed to take 13 mins to complete, but due to some problem , somebody killed that process a.sh using kill -9 <pid of a.sh>, so i want to log the message that process a.sh is killed ....
Unless of course you are doing something strange like piping the output of a function, in which case there will be strange behavior becasue of the focred subshell.
hey buddies, thanx a lot....
i found the problem, the thing is TRAP is not yet installed...in my box...
i need further assistance from your end, i.e.
1 I would like to install the TRAP in my box,
>The steps, from where should i get the utility, and instruction
manual from your side........can i get it ????
2 This question is the silly one, but >how to know which version of
bash i am working ????
the same thing i did, only difference is i have not given #!/bin/bash.....
and for stopping/break i used to press CTRL-C,Z as stated earlier..but it is not showing any echo..
Runnnig process id is : 22345
60
-------
-----
in between this if i am pressing CTRL-C,Z, nothing is echoing.....
am i doing any wrong way to trace ?????
Move the trap statement to just after the function definition. You are currently installing the trap handler as the very last step before the script exits. Install it as soon as possible.