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

17 comments: Leave Your Comments

  1. you are posting a good information for people and keep maintain and give more updates too.


    seo company in india

    ReplyDelete
  2. 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
  3. 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
  4. 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
  5. very nice blog this course very useful to us this gives the big opportunity to study course details us i like this information very much.

    Base SAS Training in chennai

    ReplyDelete

  6. Thanks for share your topic and get more information topic to be discuss your page For more details:Find Girls,Bharat Matrimony,SC Matrimony,Brahmin Matrimony.

    ReplyDelete
  7. These ways are very simple and very much useful, as a beginner level these helped me a lot thanks fore sharing these kinds of useful and knowledgeable information.

    Hadoop Training in Chennai

    ReplyDelete
  8. So now your strategy is great... you have to begin to figure out how to trust it. After all taekwondo kicks work if the strategy is correct. Furthermore, your kicks will work on the off chance that you let them stream. So discover approaches to make yourself unwind in Dojang. Drop your shoulders when they feel tense. Inhale and shake your legs on the off chance that you get apprehensive. Venture back and grin in the event that you have a craving for fueling a kick into the pack.

    On the off chance that you are not used to unwinding it takes work. You need to continue reminding yourself it's OK to give up. Be that as it may, once you begin to believe your taekwondo kicks your outcomes will be fabulous! itfofindia.com.

    ReplyDelete
  9. 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
  10. 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
  11. Its really very useful topic. Thanks for sharing this information.

    SAP Training in Chennai

    ReplyDelete
  12. Wonderful blog and very useful.Thanks for sharing this valuable information...
    SAP scm Training in Chennai

    ReplyDelete
  13. This information is impressive; I am inspired with your post writing style.Its a wonderful post and very helpful, thanks for all this information.
    SAP HR Training in Chennai
    SAP SD Training in Chennai
    SAP Basis Training in Chennai

    ReplyDelete