new power script added
This commit is contained in:
parent
b1d06d5f86
commit
2e43676608
1 changed files with 28 additions and 0 deletions
28
power
Executable file
28
power
Executable 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
|
Loading…
Reference in a new issue