new power script added

This commit is contained in:
Tobias Schmidl 2015-03-08 14:55:38 +01:00
parent b1d06d5f86
commit 2e43676608

28
power Executable file
View file

@ -0,0 +1,28 @@
#! /bin/sh
scriptname=`basename $0`;
logme() {
logger -t $scriptname -p local1.$1 $2
}
case "$1" in
lock)
lock || logme err "lock failed";
;;
logout)
logout || logme err "logout failed";
;;
suspend|hibernate|suspend-hybrid)
lock && sudo /usr/sbin/pm-$1 || logme err "$1 failed";
;;
reboot)
lock && sudo /sbin/reboot || logme err "reboot failed";
;;
shutdown|halt)
sudo /sbin/halt || logme err "shutdown failed";
;;
*)
echo "Usage: $scriptname {lock|logout|suspend|suspend-hybrid|hibernate|reboot|shutdown|halt}";
false;
;;
esac