Pls check /etc/rc.button folder. You can find scripts which is used for the switch button. You can just try to modify and add your own script.