dotfiles/power

29 lines
557 B
Text
Raw Normal View History

2015-03-08 14:55:38 +01:00
#! /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