Signal shutdown when press quit?


Hi All,

I am trying to do my personal Retroarch distro based on Debian, just for fun, I would like to know if there is a way to trigger a shutdown system signal pressing quit or if I can add a further voice to shutdown the signal. In the meanwhile I am trying to figure out how the create a demon that checks the status of Retroarch and actives the shutdown when the program is closed.