Shell script termination notification -


i have requirement in shell script in case if shell terminates reason i.e terminal closed or user terminated, work clean , unlocking etc. possible? if please explain how can done. in advance, praveen p b

yes possible. check signal using trap command. see help trap.

example

cleanup() {     ...     exit }  trap cleanup sigint # user terminated trap cleanup sighup # terminal closed trap cleanup sigterm # killed kill -15 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -