a28c9a1b8f6995472b921e9e94253ba7816d2435
[pandora-libraries.git] / testdata / scripts / op_power.sh
1 #!/bin/bash
2 #actions done when the menu button is pressed
3 #only argument is the time the button was pressed in  seconds
4
5 if [ "$1" -le "1" ]; then #button was pressed 1 sec or less, resume
6   pndrunning=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p')
7   for PID in $pidlist
8   do
9     kill -18 $PID #send SIGCONT
10   done
11   /usr/pandora/scripts/op_cpuspeed 500
12 elif [ "$1" -le "3" ]; then # button was pressed 1-3sec, "suspend"
13   pndrunning=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p')
14   for PID in $pidlist
15   do
16     kill -19 $PID #send SIGSTOP
17   done
18   /usr/pandora/scripts/op_cpuspeed 13
19 elif [ "$1" -ge "3" ]; then #button was pressed 3 sec or longer, shutdown
20   shutdown -h now
21 fi
22