activate and deactivate


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users activate and deactivate
# 1  
Old 02-22-2007
activate and deactivate

hi all

by using gethostbyname, i can know whether the net is available or not.
it is working fine when i activate or deactivate in neat.
the problem is when i remove cable(netcable) it is not working proparly,

i would like to know it.
am using fedora5, AMD
can u please help me .

thank you.
# 2  
Old 02-22-2007
I'm kinda confused on what exactly you are trying to achive. Is this "getbyhostname" used in Perl script ? On command line there are lots of utilites : ping, traceroute, mtr, tcptraceroute, and my favorite :
Code:
[root@sysgate ~]$ gethostip unix.com
unix.com 216.120.251.184 D878FBB8

Please explain in details.

I just found this in my archive :

Code:
#!/usr/local/bin/perl

use strict;
use warnings;

use Socket qw(AF_INET);

usage() if $#ARGV == -1;
display_info( @ARGV );

sub display_info {
  foreach (shift) {
    my ($ip, $host, $aliases, $addrtype, $length, @addrs);
    $ip = $_;
    if ( /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ ) {
      print "IP is $ip\n";
      ($host, $aliases, $addrtype, $length, @addrs) =
         gethostbyaddr( pack( 'C4', $1, $2, $3, $4 ), AF_INET );
      die "Reverse lookup failed to find name for $ip\n" unless $host;
    }
    $host = $ip unless $host;
    print "Hostname is $host\n";
    ($host, $aliases, $addrtype, $length, @addrs) = gethostbyname( $host );
    die "Lookup failed to find address for $host\n" unless @addrs;
    print "Maps to these IPs:\n";
    foreach (@addrs) {
      print "IP: ".join( '.', unpack( 'C4', $_ ) )."\n";
    }
  }
}

sub usage {
  print STDERR <<EOM;
Usage: getdnsinfo.pl <IP|host>...
Example `getdnsinfo.pl domain.com'
EOM
  exit( 0 );
}

Is it something similar that you are doing ?
# 3  
Old 02-23-2007
thank you

it is amazing.

but still have a problem

when i typed in terminal gethostip unix.com

is working,when i remove the cable(connection) at the cpu.

it not working. it very slow. what can i do.

to work it fast.

help me.

thank you
# 4  
Old 02-23-2007
Um, which cable you're removing ? The NIC cable ? How come then you have connection, or I'm wrong ......
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Activate and deactivate function within a ksh script

Hi, I have written a function which will blink a text "Scanning...". Now in the main script when I am doing the scan in the server I want to call this function so that user will see a blinking text on the screen and at the same time script will proceed will the scan function. Once scan is... (2 Replies)
Discussion started by: suhasingale
2 Replies

2. UNIX for Dummies Questions & Answers

Unable to deactivate a Volume Group

We want to deactivate a VG but failed, because one of the LVs created there is busy. When we are trying to unmount the LV, it is telling "not mounted" and if I execute mount command it will be informing us "already mounted". dmsetup info is indicating "Open Count = 1". Please help me, how we... (5 Replies)
Discussion started by: atanubanerji
5 Replies

3. Solaris

Deactivate a user account in Solaris 10

Hi, I need to deactivate a user account for some time and then reactivate the user account ... Can anybody please help me how to do this..... I don't have root privileges but i have sudo to privileges. Thanks.... (3 Replies)
Discussion started by: firestar
3 Replies

4. UNIX for Advanced & Expert Users

Deactivate a user account in Solaris 10

Hi, I need to deactivate a user account for some time and then reactivate the user account ... Can anybody please help me how to do this..... I don't have root privileges but i have sudo to privileges. Thanks.... Thread closed. Double post. Continued here. (0 Replies)
Discussion started by: firestar
0 Replies

5. IP Networking

How to activate a network interface?

What are the steps between "ifconfig eth0 UP" and "net_device->open"? ifconfig eth0 UP => ioctl(skfd, SIOCSIFFLAGS, &ifr) (ifr.ifr_flags = IFF_UP | IFF_RUNNING) => ????? => what are these steps? net_device->open Thanks! (1 Reply)
Discussion started by: samuncle
1 Replies

6. AIX

How to activate the NTP on AIX 5.3

Hello everyone; can any help me to know how to activate the NTP on mein AIX server? The proprosal its thet 3 oder servers are synv on time. Thaks, and regards (3 Replies)
Discussion started by: GEIER
3 Replies

7. UNIX for Dummies Questions & Answers

deactivate users

Hi all, we are running an hp-ux sd32 server with hp-ux 11.11 and i have to modify 130 users on the system, so that they are inactive. We have not installed the security package, so i cannot use usermod -e 2/24/04 qsc0017. Is there anyone who knows one command which i can use to change the user... (2 Replies)
Discussion started by: ortsvorsteher
2 Replies

8. UNIX for Dummies Questions & Answers

how do i activate php on linux....

i have activated mysql, and apache on my redhat 9 box, i went to mr BASH and wrote a php script, and it wouldn't execute. any help????????????????????????????????????? is there something that i need to activate??????? i have RUBY on there too,does it matter or no??? ... (2 Replies)
Discussion started by: mbabeli
2 Replies

9. Slackware

how to activate USB mouse

:confused: I am using Linux for a while and now changed to slackware for my study and it is not as good as redhat everytime when you add this or that it needs either configure modules or recompile kernel Now I changed from PS/2 mouse to USB trouble starts it refuse to work I know I can... (3 Replies)
Discussion started by: slackware
3 Replies
Login or Register to Ask a Question