- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script help.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2011 12:34 PM
08-26-2011 12:34 PM
Re: Script help.
Why use external commands if perl supports this though modules extremely well?
#!/usr/bin/perl use strict; use warnings; use LWP; use LWP::UserAgent; use Mail::Sendmail; my %apps = ( appnameA => "boxA.foobar.com", appnameB => "boxB.foobar.com", appnameC => "boxC.foobar.com", ); my $port = 5000; my $ua = LWP::UserAgent->new ( agent => "Opera/11.00 opera 11", cookie_jar => {}, ); while (my ($service, $box) = each %apps) { my $url = qq(http://$box:$port/segment/region/phase/dest?app=$service); my $rsp = $ua->request (HTTP::Request->new (GET => $url)); $rsp->is_success or die "get failed: ", $rsp->status_line, "\n"; if ($rsp->content =~ m/DISABLED/) { sendmail ( To => 'allanm@foobar.com', From => 'me@this.box', Subject => "$service down on $box", Message => "Please fix", ) or die $Mail::Sendmail::error; } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2011 06:48 AM
08-28-2011 06:48 AM
Re: Script help.
@H.Merijn Brand (procura wrote:Why use external commands if perl supports this though modules extremely well?
I agree, particularly from a portability standpoint. Of course, Allan is probably running Perl 5.8.8 from the standard HP-UX distributions. He would need to install the LWP::UserAgent (perhaps) and Mail::SendMail from CPAN. While this is trivial, some sites are reticent in these regards :-(
Regards!
...JRF...
- « Previous
-
- 1
- 2
- Next »