473,761 Members | 8,651 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using perl to check services

Hi,

I wrote this little script to check to see if our Lotus Notes servers are
running, and from the command line it works fine if I type perl
notescheck.pl

When I invoke the script from a web page I get an error:
Internal Server Error
The server encountered an internal error or misconfiguratio n and was unable
to complete your request.

Please contact the server administrator, yo*@example.com and inform them of
the time the error occurred, and anything you might have done that may have
caused the error.

More information about this error may be available in the server error log.

Here is the script:

#!/usr/bin/perl -w
#use strict;
use IO::Socket;

$hostName = notesserver;
my $host = shift || $hostName;
my $port = shift || 25;
my $sock = new
IO::Socket::INE T(PeerAddr=>$ho st,PeerPort=>$p ort,Proto=>'tcp ');
if($sock)
{
print "<script>
alert(\"Server notesserver is running...\");
history.back();
</script>";
exit;
}
else
{
print "<script>
alert(\"Server notesserver appears to be down...\");
history.back();
</script>";
exit;
}
close $sock or die "close: $!";

When I run the script from the console (perl notescheck.pl) I get the
following:

<script>
alert("Server RSLNM02 is running...");
history.back();
</script>[root@rts cgi-bin]#
....which tells me the script is running fine.

Heres the code from the web page:

<form action="/cgi-bin/notescheck.pl" method="post">
<input type="submit">

Can anyone tell me why this doesn't work?

Thanks,
Jason


Jul 19 '05 #1
3 7859
In article <qV************ *********@news2 0.bellglobal.co m>, Jason Miles
<ry*****@bellne xxia.net> wrote:
Hi,

I wrote this little script to check to see if our Lotus Notes servers are
running, and from the command line it works fine if I type perl
notescheck.pl

When I invoke the script from a web page I get an error:
[server error snipped]

Here is the script:

#!/usr/bin/perl -w
#use strict;
use IO::Socket;

$hostName = notesserver; ^^^^^^^^^^^ bareword?
my $host = shift || $hostName;
my $port = shift || 25;
my $sock = new
IO::Socket::INE T(PeerAddr=>$ho st,PeerPort=>$p ort,Proto=>'tcp ');
if($sock)
{
print "<script>
alert(\"Server notesserver is running...\");
history.back();
</script>";
exit;
}
else
{
print "<script>
alert(\"Server notesserver appears to be down...\");
history.back();
</script>";
exit;
}
close $sock or die "close: $!";


Is this the code you ran? It contains a bare-word 'noteserver', which
should probably be a variable or a string, but you do not show how it
gets the value 'RSLNM02'. You would have noticed this if you had left
the 'use strict;' line uncommented. Please do not ask people to find
problems that the compiler can easily find.

What is the error message in the server log? (You did look for the
error message in the server log, didn't you?)

Try

perldoc -q 500

for more help, particularly about the proper newsgroup for posting
about web server questions (your Perl program looks OK, except for the
noted error).

Finally, this newsgroup is defunct. Try comp.lang.perl. misc in the
future for Perl questions.
Jul 19 '05 #2
On Tue, 06 Apr 2004 13:27:26 -0700, Jim Gibson wrote:
In article <qV************ *********@news2 0.bellglobal.co m>, Jason Miles
<ry*****@bellne xxia.net> wrote:
Hi,

I wrote this little script to check to see if our Lotus Notes servers
are running, and from the command line it works fine if I type perl
notescheck.pl

When I invoke the script from a web page I get an error:


[server error snipped]

Here is the script:

#!/usr/bin/perl -w
#use strict;
use IO::Socket;

$hostName = notesserver;

^^^^^^^^^^^ bareword?
my $host = shift || $hostName;
my $port = shift || 25;
my $sock = new
IO::Socket::INE T(PeerAddr=>$ho st,PeerPort=>$p ort,Proto=>'tcp ');
if($sock)
{
print "<script>
alert(\"Server notesserver is running...\");
history.back();
</script>";
exit;
}
else
{
print "<script>
alert(\"Server notesserver appears to be down...\");
history.back();
</script>";
exit;
}
close $sock or die "close: $!";

Is this the code you ran? It contains a bare-word 'noteserver', which
should probably be a variable or a string, but you do not show how it
gets the value 'RSLNM02'. You would have noticed this if you had left
the 'use strict;' line uncommented. Please do not ask people to find
problems that the compiler can easily find.

What is the error message in the server log? (You did look for the error
message in the server log, didn't you?)

Try

perldoc -q 500

for more help, particularly about the proper newsgroup for posting about
web server questions (your Perl program looks OK, except for the noted
error).

Finally, this newsgroup is defunct. Try comp.lang.perl. misc in the
future for Perl questions.


This may be a stupid question, other then the bare word, isn't this script
also missing the content type, so the output is interpreted by the browser
as a a web page?
Jul 19 '05 #3
Yes, that's exactly what the problem was. Thanks for your replies...

"James T" <turajb@_NOSPAM _hoflink.com> wrote in message
news:pan.2004.0 4.07.03.28.06.7 65573@_NOSPAM_h oflink.com...
On Tue, 06 Apr 2004 13:27:26 -0700, Jim Gibson wrote:
In article <qV************ *********@news2 0.bellglobal.co m>, Jason Miles
<ry*****@bellne xxia.net> wrote:
Hi,

I wrote this little script to check to see if our Lotus Notes servers
are running, and from the command line it works fine if I type perl
notescheck.pl

When I invoke the script from a web page I get an error:


[server error snipped]

Here is the script:

#!/usr/bin/perl -w
#use strict;
use IO::Socket;

$hostName = notesserver;

^^^^^^^^^^^ bareword?
my $host = shift || $hostName;
my $port = shift || 25;
my $sock = new
IO::Socket::INE T(PeerAddr=>$ho st,PeerPort=>$p ort,Proto=>'tcp ');
if($sock)
{
print "<script>
alert(\"Server notesserver is running...\");
history.back();
</script>";
exit;
}
else
{
print "<script>
alert(\"Server notesserver appears to be down...\");
history.back();
</script>";
exit;
}
close $sock or die "close: $!";

Is this the code you ran? It contains a bare-word 'noteserver', which
should probably be a variable or a string, but you do not show how it
gets the value 'RSLNM02'. You would have noticed this if you had left
the 'use strict;' line uncommented. Please do not ask people to find
problems that the compiler can easily find.

What is the error message in the server log? (You did look for the error
message in the server log, didn't you?)

Try

perldoc -q 500

for more help, particularly about the proper newsgroup for posting about
web server questions (your Perl program looks OK, except for the noted
error).

Finally, this newsgroup is defunct. Try comp.lang.perl. misc in the
future for Perl questions.


This may be a stupid question, other then the bare word, isn't this script
also missing the content type, so the output is interpreted by the browser
as a a web page?

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3033
by: bezeee | last post by:
At my work we are in the process of building a tool to test an XML based API. Basically, XML in and XML out over http. Currently, there are two engines that do all of the schema validations, xml diffs, sending/receiving, etc. One of these engines in implemented in C# and the other in Java. Now the choice comes down to which scripting language we choose (Perl, Python or Jython) to tie into one of these engines. The scripting language...
121
10149
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
0
2312
by: Peter Conrey | last post by:
I have a perl web service (using SOAP::Lite) with a method called "Detail" that returns a strucure (hash reference to be exact). It works fine when consumed by a Perl client, but when I try to consume it with a C# application, I get the following runtime error from C#: Cannot assign object of type System.Xml.XmlNode to an object of type ConsoleApplication1.com.hilton.crmdev.SummaryType. Below is the Perl code that generates the hash,...
2
15993
by: kelly | last post by:
Hi, I don't have a code to show you, what I need are references or algorithms so that I'm in a right track. By the way, thanks for introducing me the array or arrays. Now I can continue my script. Now I want to delete a line from a file. Line being the strings I got/saved to/from array of arrays.
3
2620
by: Jay-nospam | last post by:
Hi there, I am having trouble getting an ASP.NET web application to connect to another computer and passing the proper credentials and I hope someone can help me. I have a stand-alone Windows 2003 Server, ServerA, running as a Web Server that uses ASP.NET. The default.aspx file tries to access a file in a share on another computer, ServerB. ServerA and ServerB are on the same domain and are both running Windows 2003 Server.
21
34436
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
1
1943
by: pchaw | last post by:
I try to develop a demo, which client in Perl will try to call the web services I wrote in C#. I've no knowledge in Perl, but as I refer to online forum, I try to follow their example but return no result. I've installed ActivePerl in my Win XP and tested my perl with the code below and it's successful. #!/bin/perl -w
1
8285
by: parimalb | last post by:
Hi All, I want to pass an array argument to the java webservice from perl client using SOAP::LITE package. Please let me know if anyone knows about this. The web method declaration in java is like this publishSimpleMetric(Arraylist<String> appinfo,Arraylist<String> metricinfo,String seperator); Now i tried to call the web service from perl client as follows ...
1
4349
by: spatro | last post by:
Hi, I am trying to install DBD::mysql using the CPAN and I am facing the following error: cpan> install DBD::mysql CPAN: Storable loaded ok Going to read /root/.cpan/Metadata Warning: Found only 0 objects in /root/.cpan/Metadata CPAN: LWP::UserAgent loaded ok
0
9345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.