How to detect power off switch and graceful shutdown

I have a BeagleBone Black C running the Debian that came with it. I have a program that I run on startup. This beagle bone basically acts as standalone device, that the user either powers up, or down. For powering down, I believe I understand there is a power off type button. Does that send a normal shutdown, so if I have a signal handler on my application for kill, I can shutdown my application normally? Or do I have to catch the power down button signal and then issue a shutdown to the OS as part of my application termination?