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. 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. 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
  5. 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
  6. 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
  7. Its really very useful topic. Thanks for sharing this information.

    SAP Training in Chennai

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

    ReplyDelete
  9. Excellent Post! Thanks for sharing the information. Very informative blog post.
    Mobile App Development Company

    ReplyDelete
  10. Robotic Process Automation (RPA) is one of the most exciting developments in Business Process Management (BPM) in recent history. Some industry experts believe it may be even more transformational than cloud computing transformational than cloud Automationminds team. (RPA)Automationminds lets you program in (RPA),
    Robotic Process Automation course bluePrism

    ReplyDelete
  11. 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

  12. Amazing blog! Thank you for sharing.

    Alteza is a leading online pharmacy app development company and we address every concern of our clients by providing comprehensive online pharmacy apps for their business needs.

    ReplyDelete