Wednesday, May 18, 2011

Check GMAIL for new messages:

Here is small simple shell script for checking if there is new message arrived in your GMAIL inbox. It will show popup GUI window in your KDE GUI environment:


#!/bin/sh
user= # Enter your GMAIL username here
pass= # Enter your password
stara=0
# export https_proxy=IP:PORT # If you are using proxy, set it up here
while :
do
novi=`wget -T 3 -t 1 -q --secure-protocol=TLSv1 --no-check-certificate --user=$user --password=$pass https://mail.google.com/mail/feed/atom -O - | grep "fullcount" | cut -d ">" -f 2 | cut -d "<" -f 1`
if [ $novi -ne $stara ]
then
stara=$novi
zenity --info --title "Gmail Check" --text "You have $novi new messages"
fi
sleep 5
done

Note that if you want to run this in background, then you can choose one of two ways:

1. Insert it into crontab
2. Run it in background.

No comments:

Post a Comment