Sponsored Content
Top Forums Shell Programming and Scripting Help with Perl script that can check a URL and notifiy when changes occur Post 302725669 by adam1mc on Friday 2nd of November 2012 01:01:04 PM
Old 11-02-2012
Help with Perl script that can check a URL and notifiy when changes occur

I'm a scripting newbie and I'm trying to learn. No better way than being assigned a project.

So basically, I'm trying to come up with a script that can periodically check a URL and then notify when changes occur to the file.

So what I'm thinking is that I need to devise a PERL script that can:
  • check a predefined URL
  • wget the page
  • count the number of lines that appear in the document
  • store that information to a file
  • and then do the same 10 minutes later
    • if the number of lines of the file is greater than the previous check
    • then send an email.
I haven't gotten very far. So far I've got:
Code:
#!/usr/bin/perl

system ('wget -O tempfile.txt "http://www.google.com"'); 
@lines = <tempfile.txt>

Which seems to get the file and save it to tempfile.txt, but it's not counting the lines.


From what I've been reading, I think I need to use PRINT in order to print the number of lines to a document.... but I'm kind of hung up at this point.


Anyone feel like lending a hand?


Thanks

Last edited by adam1mc; 11-02-2012 at 02:01 PM.. Reason: typo
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check URL using PERL

I am trying to create a perl script that will make sure a web page can be accessed going through an Apache httpd. The actual content of the web page does not matter. Most likely the web page will just have "You have successfully reached this port." This script will eventually be running... (5 Replies)
Discussion started by: rehoboth
5 Replies

2. UNIX for Advanced & Expert Users

url calling and parameter passing to url in script

Hi all, I need to write a unix script in which need to call a url. Then need to pass parameters to that url. please help. Regards, gander_ss (1 Reply)
Discussion started by: gander_ss
1 Replies

3. Shell Programming and Scripting

url calling and parameter passing to url in script

Hi all, I need to write a unix script in which need to call a url. Then need to pass parameters to that url. please help. Regards, gander_ss (1 Reply)
Discussion started by: gander_ss
1 Replies

4. Shell Programming and Scripting

Check URL with ksh

Hi everybody, I'm currently writing a ksh script which automates the entire startup of a large number of Tibco BusinessWorks domains, as well as all the deployed components running on it. My script is to be used after an infrastructure release, when the entire environement is down. It... (1 Reply)
Discussion started by: HexAnubis666
1 Replies

5. Shell Programming and Scripting

wget to check an URL

I all, I wrote an script which starts a Weblogic server and waits until its loaded to deploy several apps. The way I checked was something like: while ; do wget --spider <URL>:<port>/console > /dev/null 2>&1 rc=$? done This works perfectly because it's an HTML site and when server is... (2 Replies)
Discussion started by: AlbertGM
2 Replies

6. Shell Programming and Scripting

ksh to check url

I have a server that keeps going down (503 Service not available). Until we find out the problem I would like to setup a simple ksh script in cron that will query url and report the status code. This way we can get someone to restart the process. Does anyone know a simple command I can call... (5 Replies)
Discussion started by: oldman2
5 Replies

7. Shell Programming and Scripting

Url Check for a keyword.

thanks (0 Replies)
Discussion started by: kata33
0 Replies

8. Shell Programming and Scripting

Linux Script to check Active URL in Firefox

Hey guys, currently I'm struggling with a little script to check an active URL in my running Firefox. What I'm doing: I'm running a low VPS with about 768mb RAM and Ubuntu on it. I only installed Fluxbox + Firefox to it in order to keep the resource consumption as low as possible. I think i... (8 Replies)
Discussion started by: uniflow
8 Replies

9. HP-UX

Browser to check URL in hpux.

Hello Expert, I want to test the url in hp-ux, so it is possible via putty ?? Also have xmanager on the same system. (5 Replies)
Discussion started by: purushottamaher
5 Replies

10. Shell Programming and Scripting

How to check if the URL exists?

Hi, I need to check if the URL exists. Below is my OS: SunOS mymac1 Generic_148888-04 sun4v sparc SUNW,SPARC-Enterprise-T5220 I do not have the curl set in the profile nor am i aware about its path. But i have wget. Please help me with params for the same. Can you help me check if... (6 Replies)
Discussion started by: mohtashims
6 Replies
WWW::Freshmeat::Project(3pm)				User Contributed Perl Documentation			      WWW::Freshmeat::Project(3pm)

NAME
WWW::Freshmeat::Project - retrieve project information WWW::Freshmeat::Project methods The "WWW::Freshmeat::Project" object provides some of the fields from the freshmeat.net entry through the following methods url_project_page URL of project page on Freshmeat url_homepage deprecated projectname_full desc_short desc_full license trove_id Removed. projectname_short www_freshmeat Additionally, it provides the following "higher-level" methods: name description Return either "projectname_full" (respectively "desc_full") or "projectname_short" (respectively "desc_short") if the former is empty. version Returns the version of the latest release. url Removed. "url_homepage" returns a freshmeat.net URL that redirects to the actual project's home page. This url() method tries to follow the redirection and returns the actual homepage URL if it can be found, or the URL to the freshmeat.net entry for the project. branches Removed. List of branches for project. Returns hash in form of (branch id => branch name). popularity Removed. Freshmeat popularity data for project. Returns hash with keys record_hits, url_hits, subscribers url_list Removed. url_list1 Returns list of URLs for project. Each URL is a WWW::Freshmeat::Project::URL object. real_author Removed. Returns name of author (not maintainer). release_date Removed. Returns date of latest release. maintainers Removed. Returns list of names of maintainers. 1; perl v5.14.2 2012-03-05 WWW::Freshmeat::Project(3pm)
All times are GMT -4. The time now is 12:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy