command to use if someone killed the script in between?

Hi All,

I want to know about what command i can use so that it should run the below mentioned line if somebody killed the process when i run my script...

the command to run once my script is killed is

\rm -rf $LOCKDIR

Thank you

You can use trap - but you cannot trap all signals

trap "rm -rf $LOCKDIR"  [signal to trap goes here, example INT for ctrl/c interrupt]

kill -l ( that is a lowercase ELL) will show the signal names on your system.

yes i want command for ctrl/c type of interceprion...

if i want to use the trap then where do i need to use that? before the script starts?

---------- Post updated at 07:36 PM ---------- Previous update was at 07:06 PM ----------

I have seen this command somewhere in the script which i already has...

trap "cleanup; exit" 0 1 2 3 15

could you please tell me what this actually means?