# !/bin/sh if [ ! - e " $HOME/.fetchmailrc " ]; then echo " *** ERROR: you should configure 'fetchmail' to use this script. " exit 1 fi function flicker1 () { # type 1: teletyper, typically with: 0.1x2 0.3 # type 2: nailknock, typically with: 0.1 0.9 # type 3: doorknock, typically with: 0.3 1 echo 1 > / proc / acpi / asus / mled sleep $ 1 echo 0 > / proc / acpi / asus / mled sleep $ 1 echo 1 > / proc / acpi / asus / mled sleep $ 1 echo 0 > / proc / acpi / asus / mled sleep $ 2 } function flicker2 () { # type 2: ambulance, typically with: 0.5 echo 1 > / proc / acpi / asus / mled sleep $ 1 echo 0 > / proc / acpi / asus / mled sleep $ 1 } mail_status = ` / usr / bin / fetchmail - c 2 >/ dev / null | grep ' message ' ` [ `ps - e | grep osdsh` ] && (osdctrl -x ; [ `ps - e | grep osd` ] && my_pids = ($(ps - e | grep osdsh | awk ' {print $1} ' )) ; # for ((i=${#my_pids[@]}; i>0; i--));do kill ${my_pids[@]} # done ) if [ - z $mail_status ]; then if [ " $1 " != " 0 " ]; then lasttime = $(LC_ALL = C;date | awk ' {print $4,$1} ' | awk - F : ' {print $1":"$2} ' ) mplayer $HOME /. cron . d / notify . wav 2 >& 1 >/ dev / null zenity -- question -- title = " assistant says: " -- text = " New mails incoming, read now? " && ( sylpheed - claws - gtk2 && echo 0 > / proc / acpi / asus / mled && exit 0 ) || (osdsh - d 1800 && sleep 0.01 && osdctl - s " incoming mails at $lasttime " ) for ((i = 10 ; i > 0 ; i -- )); do flicker2 0.3 1 done echo 1 > / proc / acpi / asus / mled fi else echo 0 > / proc / acpi / asus / mled (osdsh - d 1800 && sleep 0.01 && osdctl - s " unread mails since $lasttime " ) fi exit 0