Sponsored Content
Top Forums Shell Programming and Scripting Get IP section from host command Post 302412366 by timgolding on Monday 12th of April 2010 10:32:28 AM
Old 04-12-2010
This seems to do the trick
Code:
#!/bin/sh -
#
#       @(#)daily.local       Tim Golding
#

# Back up
server_ip=`dig roadhaulage.com A +noall +answer | awk '{printf "%s",$5}'`
echo $server_ip

Do you think i should validate with regex to ensure it is a valid IP address IPv4, IPv6 or should i just trust this result. I want to use it to back up an SQL database from one of the live servers depending which one it resides on.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

using: ssh host command

I will remote a connection to a Unix server and launch a command on this server. This commnand requires me to set a view in Clearcase to see the vob element. How do I set a view an run a command with ssh with the syntax: ssh host command? (3 Replies)
Discussion started by: majo
3 Replies

2. UNIX for Dummies Questions & Answers

Extract time and host IP from 'who' command?

I have been slowly working towards getting a shell window in Cygwin (and/or Gnome and/or KDE) to start up and display the last time it was opened (or sourced) similarly to how the OS X Terminal does so. As close as I've been able to get so far is the 'who' command, but I can't seem to puzzle out... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

3. Shell Programming and Scripting

command to check whether the remote host is up or not

Hi, My script needs to check whether the remote host is up or not. If it is up i need to start few servers in that host or else just a notification should be sent that the remote host is down? Could someone help me out in this? Regards Arun (4 Replies)
Discussion started by: arunkumarmc
4 Replies

4. Shell Programming and Scripting

Extract section of file based on word in section

I have a list of Servers in no particular order as follows: virtualMachines="IIBSBS IIBVICDMS01 IIBVICMA01"And I am generating some output from a pre-existing script that gives me the following (this is a sample output selection). 9/17/2010 8:00:05 PM: Normal backup using VDRBACKUPS... (2 Replies)
Discussion started by: jelloir
2 Replies

5. UNIX for Dummies Questions & Answers

Host command

hi guys I have standalone Suse 10 SP3 that when I run # hostname webserver but when I run host command # host webserver ;; connection timed out; no servers could be reached I would like to get the IP when I issue host webserver x.x.x.x and the name when host x.x.x.x... (1 Reply)
Discussion started by: karlochacon
1 Replies

6. IP Networking

ping can not recognize host but host command can

Hi, I have a weird problem. when ever I do ping command like for example ping unix.comI get the following message: # ping unix.com ping: unknown host unix.com but when I use host the computer is able to know the host. # host unix.com unix.com has address 81.17.242.186 unix.com mail is... (2 Replies)
Discussion started by: programAngel
2 Replies

7. Shell Programming and Scripting

Prepend first line of section to each line until the next section header

I have searched in a variety of ways in a variety of places but have come up empty. I would like to prepend a portion of a section header to each following line until the next section header. I have been using sed for most things up until now but I'd go for a solution in just about anything--... (7 Replies)
Discussion started by: pagrus
7 Replies

8. Shell Programming and Scripting

Command host with awk

Hi all, Please, why "echo" instruction: iphost="$(ssh root@$machine -x "host $machine | awk '/has address/ { print $4 }'")" echo $iphost display: g-3.xx.yyy.zz has address 172.16.65.35 instead of: 172.16.65.35 ? Perharps, i have to extract 172.16.65.35 from the... (5 Replies)
Discussion started by: chercheur111
5 Replies

9. UNIX for Dummies Questions & Answers

What is the command used to list all connections on a host?

give the syntax (3 Replies)
Discussion started by: sonu pandey
3 Replies
MIREDO-SERVER.CONF(5)					      System Manager's Manual					     MIREDO-SERVER.CONF(5)

NAME
miredo-server.conf - configuration for miredo-server SYNOPSIS
miredo-server.conf DESCRIPTON
miredo-server.conf is the configuration file for miredo-server. Each configuration directive consists of one directive name, possibly followed by one or several spaces and a value for the directive. White spaces, empty lines and lines starting with '#' are ignored. Directives are case-insensitive. A comprehensive list of the supported directives follows: SERVER OPTIONS
ServerBindAddress server_ip Specifies the primary IPv4 address of the Teredo server. miredo-server will bind to UDP/IPv4 port 3544 on this address and waits for packets from Teredo clients. It will advertise the Teredo prefix which is defined with the Prefix directive. A Teredo server needs two subsequent IPv4 addresses. It will wait for UDP IPv4 packets on port 3544 on both addresses. server_ip specifies the lowest of both IPv4 addresses, which is known as the primary IPv4 server address. The secondary IPv4 address should be server_ip + 1 and must also be assigned to the server. ServerBindAddress2 server_ip2 It is possible to specify a secondary IPv4 server address manually. However, Miredo clients will need manual configuration (with the ServerAddress2 directive in miredo.conf). Other Teredo clients are believed not to support such setup. Prefix teredo_prefix This directive specifies the Teredo prefix which the Teredo relay and/or server will advertise. teredo_prefix must be a valid IPv6 prefix. The default value is 2001:0000::. A 32-bits prefix is required to use this option. Since you do not have such big an IPv6 prefix YOU WILL NOT USE THIS OPTION. Moreover, certain third party Teredo client implementations require the default prefix. InterfaceMTU mtu This directive overrides the value of the MTU that is advertised to Teredo clients. The default value is 1280 bytes and should not be changed if the default Teredo prefix is used. YOU MUST NOT USE THIS OPTION with the default prefix. This would break interoperability with most Teredo relays. SyslogFacility facility Specify which syslog's facility is to be used by miredo-server for logging. Possible values are: daemon (the default), local0, ... local7, kern and user (see syslog(2)). SEE ALSO
miredo-server(8) AUTHOR
Remi Denis-Courmont <remi at remlab dot net> http://www.remlab.net/miredo/ miredo February 2008 MIREDO-SERVER.CONF(5)
All times are GMT -4. The time now is 03:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy