Sponsored Content
Top Forums Shell Programming and Scripting Script to determine server IP Post 302958403 by bobby320 on Wednesday 21st of October 2015 05:37:46 PM
Old 10-21-2015
Script to determine server IP

Need help with the script, I am trying to include this script as part of kickstart profile.

based of the host's IP address, in this case if the host is IP starting with 10.10.3.* or 10.10.6.*, I will be pushing appropriate routing file from my web server.

I validate host IP from nslookup.

Code:
#!/bin/bash
SHORT=`hostname -s`
IP=`nslookup $SHORT | grep 10.10.3 | awk '{print $2}'`
if [ $IP -eq ^10.10.3 ]
then
        echo "Server has $IP IP address"
else
        IP6=`nslookup $SHORT | grep 10.10.6 | awk '{print $2}'`
        echo "sever has $IP6 IP address"
fi


it is failing with this error message, please suggest.

Code:
# /tmp/csip
/tmp/csip: line 4: [: 10.10.3.13: integer expression expected
sever has  IP address

Thanks,
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to determine the script is called from CRON?

Hello expert, What I want is to determine whether the script is called from CRON or it is executed interactively? I tried the following but no luck: #!/bin/ksh cronID=`pgrep -x cron` GPID=`ps -ef -o ppid,pid | grep " $PPID$" | awk '{print $1}'` if ; then echo I am being run... (15 Replies)
Discussion started by: wes_brooks
15 Replies

2. UNIX for Dummies Questions & Answers

Installer script needs to determine own location...

My n00b question: I am trying to write a script that I can place on a flash drive and then move from computer to computer and install a file, which is bundled with the script. (ie the script is at /Volumes/FlashDrive/Folder/Script, the file is at /Volumes/FlashDrive/Folder/File) So far I have... (1 Reply)
Discussion started by: madmacs
1 Replies

3. UNIX for Dummies Questions & Answers

Determine FULL name of current script

Hi everyone, Is there a slick way to determine the FULL name of a script that is running? The variable ${0} just gives the relative path name. I guess I could just do the following: FULL_SCRIPT_NAME=${PWD}${0}Although that's pretty simple is there another way that I am missing? ... (4 Replies)
Discussion started by: msb65
4 Replies

4. UNIX for Dummies Questions & Answers

Script to determine logged in time

Hi all So I am thinking my inability to cope with math is bogging me down here so Im asking for help. I want to determine how long a user has been logged on for by using the date and who commands to determine the time they have been logge don. My problem is that I keep getting the wrong... (2 Replies)
Discussion started by: losingit
2 Replies

5. IP Networking

How to Determine client's DNS server Ip

Is there a way for a server to determine client's DNS ip? I have an application that logs client's IP but in certain cases its desirable to know their DNS too (1 Reply)
Discussion started by: vickylife
1 Replies

6. Shell Programming and Scripting

Determine if variable is the Server component of UNC

Hi all, Using sh/csh, unfortunately shell scripts are not my strong suit. Trying to write a script that gets called from a program for pre-processing. The program passes individual components of a UNC (//server/path1/path2/filename). Thus the unc path of: //server/path1/path2/filename, is... (7 Replies)
Discussion started by: Festus Hagen
7 Replies

7. Shell Programming and Scripting

To determine the File Sytem Usage on Multiple UNIX server

Hello All :) I want to write a shell script to find the file system usage on multiple UNIX servers. Commands: df -g fsJCAPS Below script works fine and it displays results on terminal/console. I want to store /redirect output on to local server from where I'm running the script. ... (3 Replies)
Discussion started by: Mohammad Nawaz
3 Replies

8. Red Hat

How to determine share name of Linux server?

Hi, How to determine share name of Linux server ? OS version is RHL 6.5 Regards, Maddy (11 Replies)
Discussion started by: Maddy123
11 Replies

9. Web Development

Script to determine which web server at ip addresses

how do we determine if ip addresses are hosting IIS version 7.x or Apache 2.2.x. ? (3 Replies)
Discussion started by: NameSake
3 Replies
KSVALIDATOR(1)						      General Commands Manual						    KSVALIDATOR(1)

NAME
ksvalidator -- verify the syntax of a kickstart file SYNOPSIS
ksvalidator [-e | --firsterror] [-i | --followincludes] [-l | --listversions] [-v | --version VERSION] INFILE DESCRIPTION
ksvalidator is a program that takes an input kickstart file and attempts to verify that it is syntactically correct. This includes check- ing basics like proper quoting and making sure required options have values, and more advanced checks like verifying the file does not include deprecated or removed kickstart commands. Mutually exclusive options can also be caught, as can certain classes of partitioning errors (like using the same device name multiple times). ksvalidator does have its limitations. It cannot run validate the syntax of %pre and %post scripts, nor does it attempt to run them. It cannot check that the %packages section is valid. Most importantly, it cannot guarantee that an input kickstart file will install prop- erly, because it does not understand the complexities of partitioning and what potentially already exists on disk. EXIT STATUS
ksvalidator returns 0 on success, and 1 if INFILE does not exist or there is an error parsing the kickstart file. OPTIONS
-e, --firsterror Stop on the first warning or error. By default, ksvalidator will attempt to process the entire file, potentially raising multi- ple errors. -i, --followincludes Process included files in the input file when they are seen, like anaconda would. If the included file does not exist (this can happen for a variety of reasons, but the most common being a %pre script that generates an included file) and this option is given, an error will be generated and processing halted. -l, --listversions List all versions of kickstart syntax supported by ksvalidator. This is useful for determining what values can be fed back in on a second run. -v, --version VERSION Use this version of kickstart syntax when processing the file, or the latest if no version is given. SEE ALSO
ksflatten (1), ksverdiff (1) KSVALIDATOR(1)
All times are GMT -4. The time now is 06:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy