Sponsored Content
Operating Systems Linux Red Hat How to check if the Linux Box is available Post 302427423 by pseudocoder on Saturday 5th of June 2010 12:07:00 PM
Old 06-05-2010
You could run a daemon/server on the target machines:
Code:
#!/usr/bin/perl

 # server1.pl - a simple server


 use strict;

 use Socket;


 # use port 7890 as default

 my $port = shift || 7890;

 my $proto = getprotobyname('tcp');


 # create a socket, make it reusable

 socket(SERVER, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";

 setsockopt(SERVER, SOL_SOCKET, SO_REUSEADDR, 1) or die "setsock: $!";


 # grab a port on this machine

 my $paddr = sockaddr_in($port, INADDR_ANY);


 # bind to a port, then listen

 bind(SERVER, $paddr)      or die "bind: $!";

 listen(SERVER, SOMAXCONN) or die "listen: $!";

 print "SERVER started on port $port\n";

 $| = 1;


 # for each connection...

 my $client_addr;

 while ($client_addr = accept(CLIENT, SERVER)) {
    # find out who connected
    my ($client_port, $client_ip) =
                     sockaddr_in($client_addr);
    my $client_ipnum = inet_ntoa($client_ip);
    my $client_host =
             gethostbyaddr($client_ip, AF_INET);
    # tell who connected
    print "got a connection from: $client_host",
          " [$client_ipnum]\n";
    # send them a message, close connection
    my $w = `w`;
    # log the access event
    print CLIENT "$w\n ";
    close CLIENT;

 }

Now when you run telnet targetmachine 7890 you will see the output of the command w.
http://targetmachine:7890 should also work.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to Reboot a linux box from a windows box

HI All, I need a script to reboot a linux box from a windows box. The script needs to run automatically whenever a sitescope alerts with an error message. Have searched for this in the forums, but could not get something relative. Pls. let me know the various alternatives we have to do... (2 Replies)
Discussion started by: Crazy_murli
2 Replies

2. UNIX for Dummies Questions & Answers

How to check if DHCP is running on HP-UX box?

Hello all, Can someone help me with a command to check if DHCP is running on HP-UX box? Thanks (1 Reply)
Discussion started by: nuGuy
1 Replies

3. HP-UX

How to check if DHCP is running on HP-UX box?

Hello all, Can someone help me with a command to check if DHCP is running on HP-UX box? Thanks (2 Replies)
Discussion started by: nuGuy
2 Replies

4. Shell Programming and Scripting

PHP required check box

I am new to PHP scripting. I have a page with a checkbox and I'd like to make it required before submiting Here is the code I have for displaying: <tr> <td align="center" colspan="4"><font size="2" color="#990000" face="Arial, Helvetica, sans-serif"> By checking this box you agree... (1 Reply)
Discussion started by: lochraven
1 Replies

5. Linux

How to find remote Linux box login account without login in to that box?

Hi, How to find remote Linux box login account without login in to that box? I don't have login account at my remote Linux box. But I need who are all having login account. How do I findout? Thanks, --Muthu. (3 Replies)
Discussion started by: Muthuselvan
3 Replies

6. UNIX for Dummies Questions & Answers

How to check if an application has been installed on a unix/linux box?

hi, guys, now I face a problem. I have developed an application, and when it starts, it shall check if an application has been installed on the running linux/unix. If result is positive, i do something with the application command. just as an example: I want to check if sshd has been... (3 Replies)
Discussion started by: sk1418
3 Replies

7. AIX

How to check the LPAR in a AIX box ?

I have login into a server, and when i launch this command uname -L. I can see there is a LPAR. But is there anymore commands i can use to get more information on the LPAR ? like it is VIO ? wat the IP address ? etc, etc. please help. Thank you. (7 Replies)
Discussion started by: wingcross
7 Replies

8. UNIX for Dummies Questions & Answers

Mounting Linux box to Linux box

Hi, I've been able to mount my linux box to a windows machine, but I can't seem to mount my linux box to another linux box I have. (I know I could scp, but for other reasons I need to do it this way) Samba is installed. Here is an example where I mount to a Win machine.--> works fine mount... (12 Replies)
Discussion started by: jdilts
12 Replies

9. Red Hat

How to access redhat Linux box graphically from windows box?

Hi I have a linux box and need to access from windows graphically # uname -a Linux pc-l416116 2.6.18-155.el5 #1 SMP Fri Jun 19 17:06:47 EDT 2009 i686 i686 i386 GNU/Linux What components do I need to install on Linux and windows to do that? TIA (6 Replies)
Discussion started by: magnus29
6 Replies

10. How to Post in the The UNIX and Linux Forums

Copying , renaming the file from windox box and ftp to Linux box

Hello my dear friends, Two file are auto generated from mon - fri at different directories on same windows box.Every day i have to copy the file, rename it (specific name)and ftp it to linux box specified directory. is it possible to automate this process,If yes this has to be done from windows... (1 Reply)
Discussion started by: umesh yadav
1 Replies
roarclientpass(1)				       System User's Manual: roarclientpass					 roarclientpass(1)

NAME
roarclientpass - Passing clients to and creating new listen sockets on RoarAudio sound server SYNOPSIS
roarclientpass [OPTIONS]... DESCRIPTION
This program let you pass new clients to a RoarAudio sound server as as a proxy and let you add new listen sockets to a running server. OPTIONS
--server SERVER Set server hostname. --stdin Client is on stdin. --stdout Client is on stdout. --stdio Same as --stdin --stdout. This option may for example be used in case of being runed from a inetd. --stderr Client is on stderr. Beside to make stderr known as client fh it will disable error output on stderr. This must be used in case this program is used from inetd or simular tools. --client-fh FH Client is on FH. This is basicly the same as --client-fh on roard(1). --proto PROTO Set the protocol used by the client. Defaults to RoarAudio. --byteorder BO Sets the byteorder used by the client. Defaults to network byte order. --listen Client is a listen connection. This is not the same as --mode listen. --mode MODE Set mode of operation: none, listen or connect Defaults to none. --bind BIND Set host/node/path for mode listen and connect. --port PORT Set port for mode listen and connect. --help Show this help SEE ALSO
roartips(7), libroar(7), RoarAudio(7). HISTORY
For history information see RoarAudio(7). RoarAudio July 2010 roarclientpass(1)
All times are GMT -4. The time now is 08:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy