This is a small circuit that I developed for use with my raspberry pi. It mimics a real computer switch for powering on and off. You can press it once or as many times as you like to turn it on (so bouncy buttons are not a problem). To turn it off you need to hold the button for ~10s, determined by the RC network connected to the opamp's non inverting input. Alternatively, you could hook up the non inverting input to one of the pi's GPIO pin, through a resistor or a level shifter, so that the pi can shut its self down with a script, and still have the button working as well. Tried and tested with TL081 and basic transistors; works well.