In case i run a script in terminal and it contains a background job , in case the user close the terminal as i guess the script with his all back ground tasks will be dead , i want something like an event when the job is about to be killed or terminated , to excecute some block of code
for instance :
while sleep 3h
do
backGround job commands
done
those above is the back ground job
i want when i already pressed exit on the terminal who run the script in background and when this job is about to exist and killed to do some other commands before get terminated the whole script something like EVENTS in C# for example when something happen a block of code get executed
i hope i explained myself abundantly clear this time
Thanks in advance :)