]>
git.sthu.org Git - shutils.git/blob - X/tp_alert.sh
3 # Stefan Huber <shuber2@gmail.com>
6 # * 2009-07-24: Initial version
7 # * 2010-10-09: Use more shell commands
10 # Wait this amount of time until we activate lock
12 # Wait this amount of time after an alert call
14 # Busy wait for polling position sensor
16 # Tolerance for sensor differences
19 POSFILE
="/sys/devices/platform/hdaps/position"
23 export PATH
="/bin:/usr/bin"
28 amixer
-q sset Master
100%,100% unmute
29 echo "Alert $state at time `date`"
33 echo "Leave me alone!" | festival
--tts
37 echo "E-mail sent!" | festival
--tts
44 echo "HELP!" | festival
--tts
53 /usr
/sbin
/sendmail
$USER <<EOF
54 Subject: tp_alert.sh alarm on `hostname`
55 From: shuber@`hostname`
58 This is an automatic mail from the tp_alert.sh script:
65 if "`qdbus org.freedesktop.ScreenSaver /ScreenSaver GetActive`" \
83 if [ ! -e $POSFILE ]; then
84 echo "HDAPS position file not existing!"
89 echo "Launched at time `date`"
95 #Wait for trigger to activate alertion system
102 echo "Activated." | festival
--tts
105 #Get initial positions
110 #Now wait until alertion system is deactivated
113 diffx
=`echo "$xtilt-$initxtilt" | bc`
114 diffy
=`echo "$ytilt-$initytilt" | bc`
118 if [[ $diffx -ge $TOLERANCE ||
$diffy -ge $TOLERANCE ]]; then
124 echo "Unlocked at time `date`."
125 echo "Unlocked with state $state." | festival
--tts