This sweet littly script checks for new mail over ssh – and needs very little bandwidth, really no load on client and server, only one persistent connection and just one secure login (the ssh login on startup – unless you use keys).
First version:
ssh stud4.tuwien.ac.at -l e0123456 '
oldline=$(ls -l .inbox)
while true; do
line=$(ls -l .inbox)
if [ "$line" != "$oldline" ]; then
oldline="$line"
echo beep
fi
sleep 10
done
'
Second version:
ssh stud4.tuwien.ac.at -l e0123456 '
oldline=$(ls -l .inbox)
while true; do
line=$(ls -l .inbox)
if [ "$line" != "$oldline" ]; then
oldline="$line"
grep -E "^(From|Date|Subject):" .inbox |
tail -n 3 | { read a; read b; read c; echo "$b | $a | $c"; }
fi
sleep 10
done
'|while read line; do
mplayer biff.wav >/dev/null 2>&1
zenity --info --text="New Mail"
echo "$line"
done
The nice thing about this is that you can do on the client whatever you want .. play a sound … use zenity for a info box … etc.
BTW: I like /usr/share/sounds/gnibbles/reverse.wav as new mail sound …
all the others from find /usr/ -iname “*.wav” are to shocking for my nerves ;-)
Recent Comments