#!/bin/sh CURRENT_INIT=`ps -p 1 -o comm=` if [ "$CURRENT_INIT" = "openrc-init" ] then /sbin/openrc-shutdown -p now else /sbin/shutdown -h now "Power button pressed" fi