I work on a web application which uses memcache, mongodb etc along with a python based web framework. python needs to be in foreground so that I can see the console output, or enter debugger if required.
Currently I have a start.sh
memcache_start mongodb_start python fg and stop.sh
memcache_stop mongodb_stop scripts that does automates everything.
Normaly I kill the python in fg using Ctrl-C which kills the python. Now I need to explicitly run the stop.sh to bring the system down gracefully.
Is it possible for start.sh to be aware of the Ctrl-C SIGINT so that I can execute the stop commands as well since it is logically the next successive action that has to be performed?