Difference between revisions of "Pager Nagger"
(added warning about data destruction) |
|||
Line 1: | Line 1: | ||
+ | <b><font size="+3" color="red">WARNING! DANGER!</font> | ||
+ | |||
+ | |||
+ | This script is known to cause the wiping of data on webOS devices and may leave you with a non-functional device that may require the use of webOS Doctor to fully recover from. In short, sqlite is designed for one user per database. Accessing PalmDatabase.db3 in sqlite3 while Luna is running will eventually create a conflict where both Luna and this script attempt to access this database at the same time. When this happens, Luna will assume that its database is corrupt, delete it, recreate it,, set first use, and reboot. | ||
+ | |||
+ | Members of the community are currently investigating a better solution that works inside webOS. In the mean time, this script is considered to be dangerous. | ||
+ | |||
+ | You have been warned --destinal | ||
+ | </b> | ||
+ | |||
+ | |||
I use my phone as a pager when I'm on-call at work. The Pre's notification tone is ''way'' too short and quiet to wake me up. Here's a script that will nag you by playing a .wav file every minute while you have unread messages. The latest version also vibrates and blinks the LEDs. | I use my phone as a pager when I'm on-call at work. The Pre's notification tone is ''way'' too short and quiet to wake me up. Here's a script that will nag you by playing a .wav file every minute while you have unread messages. The latest version also vibrates and blinks the LEDs. | ||
Revision as of 20:49, 1 September 2009
WARNING! DANGER!
This script is known to cause the wiping of data on webOS devices and may leave you with a non-functional device that may require the use of webOS Doctor to fully recover from. In short, sqlite is designed for one user per database. Accessing PalmDatabase.db3 in sqlite3 while Luna is running will eventually create a conflict where both Luna and this script attempt to access this database at the same time. When this happens, Luna will assume that its database is corrupt, delete it, recreate it,, set first use, and reboot.
Members of the community are currently investigating a better solution that works inside webOS. In the mean time, this script is considered to be dangerous.
You have been warned --destinal
I use my phone as a pager when I'm on-call at work. The Pre's notification tone is way too short and quiet to wake me up. Here's a script that will nag you by playing a .wav file every minute while you have unread messages. The latest version also vibrates and blinks the LEDs.
Prerequisites
Script code
#!/bin/sh SOUND=/media/internal/ringtones/pager.wav LIGHT=1 BUZZ=1 check() { cmd='SELECT summary FROM com_palm_messaging_data_ChatThread WHERE unreadCount > 0 AND type = "SMS" AND summary != "";' output=$(echo $cmd|sqlite3 /var/luna/data/dbdata/PalmDatabase.db3 2> /dev/null) || return 0 if [ -n "$output" ] ; then return 1 fi } play() { x=0 until [ "$x" = 4 ] ; do aplay -q "$SOUND" & y=1 if [ "$BUZZ" = 1 ] ; then /usr/bin/luna-send -n 1 palm://com.palm.vibrate/vibrate {\"period\":1,\"duration\":1000\} > /dev/null 2>&1 z=10 else z=12 fi if [ "$LIGHT" = 1 ] ; then until [ "$y" = "$z" ] ; do sleep 1 echo 00 >/sys/class/leds/core_navi_left/brightness echo 100 >/sys/class/leds/core_navi_center/brightness echo 00 >/sys/class/leds/core_navi_right/brightness sleep 1 echo 80 >/sys/class/leds/core_navi_left/brightness echo 00 >/sys/class/leds/core_navi_center/brightness echo 80 >/sys/class/leds/core_navi_right/brightness sleep 1 echo 00 >/sys/class/leds/core_navi_left/brightness echo 60 >/sys/class/leds/core_navi_center/brightness echo 00 >/sys/class/leds/core_navi_right/brightness sleep 1 echo 40 >/sys/class/leds/core_navi_left/brightness echo 00 >/sys/class/leds/core_navi_center/brightness echo 40 >/sys/class/leds/core_navi_right/brightness sleep 1 echo 00 >/sys/class/leds/core_navi_left/brightness echo 00 >/sys/class/leds/core_navi_center/brightness echo 00 >/sys/class/leds/core_navi_right/brightness check if [ "$?" = 1 ] ; then y=$((y+1)) else exit 0 fi done x=$((x + 1)) else sleep 60 check if [ "$?" = 1 ] ; then x=$((x + 1)) else exit 0 fi fi done } if [ ! -f "$SOUND" ] ; then SOUND=/usr/palm/sounds/alert.wav fi check || play
Installation
- Copy a .wav file to /media/internal/ringtones/pager.wav (or to the ringtones directory in USB mode).
mkdir -p /opt/scripts
- Copy the script to /opt/scripts/pager.
chmod +x /opt/scripts/pager rootfs_open -w
- Add the following line to /etc/cron/crontabs/root:
*/5 * * * * /opt/scripts/pager
Remember to copy a .wav file to /media/internal/ringtones/pager.wav.
To Do/Bugs
As the message is marked read in the database when it is closed, the sound will continue to play every minute until the messaging app is closed (or until that chat card is closed if you've done the Create a new card for each conversation mod).
Acknowledgments
Thanks to Sargun for the tracking script which inspired the layout of the code, as well as started me looking at the databases.
This is great thanks!!