Skip to content

Instantly share code, notes, and snippets.

@Etana
Created March 31, 2013 10:10
Show Gist options
  • Save Etana/5280186 to your computer and use it in GitHub Desktop.
Save Etana/5280186 to your computer and use it in GitHub Desktop.
open gmail if there was no new email at last check and now there is ( i execute it in a cron every minute )
#! /bin/bash
num_mail=$(wget -q -O - --auth-no-challenge --user=email@gmail.com --password=my_password 'https://mail.google.com/mail/feed/atom' | awk 'gsub(/<\/?fullcount>/, "")')
export DISPLAY=:0
if [ -e "/tmp/gmail_opened" ]
then
if [[ "$num_mail" == "0" ]]
then
rm "/tmp/gmail_opened"
fi
else
if [[ "$num_mail" != "0" && "$num_mail" != "" ]]
then
touch "/tmp/gmail_opened"
chromium "https://mail.google.com/mail/u/0/?ui=html#inbox"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment