Sponsored Content
Top Forums Shell Programming and Scripting adding a host entry on another machine Post 302094280 by hcclnoodles on Thursday 26th of October 2006 11:42:37 AM
Old 10-26-2006
adding a host entry on another machine

I have written this small script to add an entry to a remote /etc/hosts file which needs to be run from our central admin box and is passed one parameter $1 <hostname>

Code:
#!/bin/ksh
echo "Which host entry would you like to add to $1"
read host_to_add
echo "what is the IP address?"
read ip

echo "Adding $host_to_add $ip to $1"
ssh $1 'echo $host_to_add $ip >> /etc/hosts'

but obviously this doesnt work because the variables arent passed over when issuing the ssh statement at the end there, so what i actually get in the target machines host file is a blank line at the end

Does anybody have an idea on how I can get around this???

Cheers
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding entry into crontab in ksh program

Hi falks, I have the following ksh function ,which adding entry to crontab during ksh program running: { print "Go\c" >/dev/null 2>&1 print '0 0 * * * su - ias -c "/home/orca/core-${SCHEMA_NAME}/CLI/cleanup_BRMS.ksh"\c' >/dev/null 2>&1 print "\033:wq!" >/dev/null 2>&1 } | \crontab -e... (2 Replies)
Discussion started by: nir_s
2 Replies

2. Linux

problem in adding an extra entry in a dir:fuse imlementation

Well the problem comes when i try to add an extra file into the existing filesystem mounted at some mountpoint containing a single file hello. suppose i add a file say "TANVIR"(c it on d line next to line no:49) , it gives me abnormal results...... like 1)d file can't be opened 2)no file... (0 Replies)
Discussion started by: Tanvirk
0 Replies

3. HP-UX

Adding printer entry into host file

Hi relatively new to unix so sorry if this is a stupid question: How do i add a printer entry into the host file. I know how to add the printer using sam, but i am required to add the host file entry into /etc/hosts which i am unaware of how to do. Any help would be greatly appreciated. (2 Replies)
Discussion started by: Wade Gava
2 Replies

4. Solaris

etc host entry problem

Dear Members, My app server is running in sun solaris. When i am trying to invoke another application running in a different m/c by calling its ip aa.bb.cc.dd , i am succeeding. But, when i maintain the same ip in etc host and try to invoke the application using the host name, it is failing.... (5 Replies)
Discussion started by: kandanathan
5 Replies

5. Solaris

How to get the IP address / Host name of client machine

Hi How to get the IP address / Host name of a particular user connected to Unix Server. For example: If used 'DevUser1' is connected to Unix server. I need to find out from which PC this connection has been made. How can this be achieved? Thanks (6 Replies)
Discussion started by: MVL
6 Replies

6. UNIX for Dummies Questions & Answers

Cannot ssh into machine although it has entry in authorized keys

We rebooted one our servers, call it server A, and now it cannot ssh into another machine, call it server B. We have the server A's ssh signature in server B's authorized key. I tried to manually generate the a new key using ssh-keygen command but the key looks nothing like the old key: It has... (10 Replies)
Discussion started by: mojoman
10 Replies

7. Red Hat

Adding or deleting an entry in /etc/inittab without using vi editrors or any editor.

Hi masters Is there any way to edit or delete an entry in inittab file without using vi or any editors? We can use commands instead or any shell script .. If any one can help deeply appreciated Thanks a lot sai (3 Replies)
Discussion started by: saidiya
3 Replies

8. UNIX for Dummies Questions & Answers

Host ID in Solaris Machine

Hi, On doing reinstallation of Solaris 10 OS, does an existing host id change? Regards, Thiru (1 Reply)
Discussion started by: nthiruvenkatam
1 Replies

9. Shell Programming and Scripting

Host Machine not listed.

Hello everyone, I have a perl script to list all the host machines in my development environment. The script does various other tasks apart from listing the host names in an excel output. The problem is with the listing of host machines. The script lists all the host names except the host on which... (1 Reply)
Discussion started by: nmattam
1 Replies

10. Shell Programming and Scripting

Modifying/Adding in the DNS server entry using shell script

Dear Experts. I need to add/modify the entries in the DNS server and this has to be achieved using shell script and below is the requirement, could you please let me know if a shell script can be written for this task? 1. Log in to primary DNS server 2. Check /etc/named.conf if zone is... (4 Replies)
Discussion started by: VKIRUPHAKARAN
4 Replies
MONO-SERVER4-ADMIN(8)					User Contributed Perl Documentation				     MONO-SERVER4-ADMIN(8)

NAME
mono-server4-admin - mono-server4 hosts file creator, hosts file is part of the debianized mod_mono package SYNOPSIS
mono-server4-admin [action] [args] OPTIONS Actions: add Use 'add' if you want to create an application and want mono-server4 scripts to manage it del If you want to remove an application Args: --path The path where you have your aspx files, MUST EXISTS!, required only with add action --app The name of your application --libs If you have dlls outside your path, you must use this! --port Needed if you are running multiple virtual hosts in different ports in Apache --vhost If you want to add asp.net support to a virtualhost you must use this. Example: foobar.com DESCRIPTION
mono-server4-admin is a perl tool to adminstrate your ASP.NET webapps that will be executed with mod_mono. When you try to add an application, mono-server4-admin will verify that your path exists, if it is, it will add a directory inside /etc/xsp/conf.d with the name of your app, and also as a file with the filename format: 10_appname. This file will have the information (path, app). So, when mono-xsp-update is executed it will read those dirs and create a debian.webapp in /etc/xsp that the xsp daemon will read, also with a mono-server4-hosts that will have your directory settings with apache directives. Apache will read mono-server4-hosts.conf! AUTHOR
Pablo Fischer <pablo@pablo.com.mx> perl v5.14.2 2012-01-18 MONO-SERVER4-ADMIN(8)
All times are GMT -4. The time now is 03:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy