An attempt to write a script to notify when a movie is listed online for booking

This is my attempt to write a shell script that sends me an email when a movie is available for booking online.

NOTE: You might want to configure 'mail' command SMTP settings on your box to avoid the mail being sent to your spam folder.

This script takes 2 arguments. The first argument is the URL that has to be monitored and the second argument is name of the theater (Or anything that is unique to that theater).

The script scrapes the URL page once in a given interval period and looks for the theater name, and when it's found it sends an email to the given email ID.


#! /bin/bash
if [ "$#" -ne 2 ]; then
    echo "Illegal number of parameters"
    echo "USAGE: movieAlert <URL> <KEYWORD>"
    exit 1
fi
EMAIL_IDS="username@mail.com"
BODY=$1
SUB="Hurry up!!!"
IP=$1
QUERY=$2
while true; do
    result=`wget -O - $IP -o /dev/null|grep $QUERY|wc -l`
    if [ $result -gt 1 ]; then
        mail -s "$SUB" "$EMAIL_IDS" <<<"$BODY"
        exit 0
    fi
    sleep 60

done

10 comments: Leave Your Comments

  1. It’s really amazing that we can record what our visitors do on our site. Thanks for sharing this awesome guide. I’m happy that I came across with your site this article is on point,thanks again and have a great day. Keep update more information..

    Best Interior Designers in Chennai
    Interior Designers in Chennai

    ReplyDelete
  2. It’s the best time to make some plans for the future and it is time to be happy. I’ve read this post and if I could I want to suggest you few interesting things or suggestions.You can write next articles referring to this article. I desire to read even more things about it..
    Java Training in Chennai
    Oracle Apps Training in Chennai
    PHP Training in Chennai

    ReplyDelete
  3. Excellent and very cool idea and the subject at the top of magnificence and I am happy to this post..Interesting post! Thanks for writing it. What's wrong with this kind of post exactly? It follows your previous guideline for post length as well as clarity..
    Storage space rental singapore
    Cheapest storage space singapore
    Van delivery service singapore

    ReplyDelete
  4. This is an awesome post.
    Really very informative and creative contents.
    These concept is a good way to enhance the knowledge.

    Hadoop Training in Chennai

    ReplyDelete
  5. As you have now understood the usage of ‘Record and Playback’ tool, the following are the different posts using which you can explore the functioning of ‘Selenium IDE’
    selenium Training in chennai

    ReplyDelete