the value of $host comes from a file that has names of servers..ie
server1
server1
server3
this is my whole script
and the line i am getting problem is this one...
because as corona mentioned, scp cannot execute a command, but my file is named in this syntax "server1.domain.com.html.gz" but if for any reason the vaule of hostname on a server does not contain the domain name, then the file would change.. so i cant put the "domain.com" as a hard value . I hope this explains a bit more.
Have you even tried anything I've suggested? They do what you want, even though that changes every other post.
If your script is getting complicated enough, you might want to avoid doing multiple ssh and scp things per server -- that can take a long time -- by combining it all into one script which gets sent to the server. ssh lets you run entire scripts on the remote server easily enough.
will act like you've ran local-file.sh on the remote host, with the arguments arg1 arg2. If you need to pass strings from the local system to the remote one, the arguments are the place to do it. It will print stream data to stdout as usual, which can be redirected in the ways I've already shown you into a local file, or multiple local files, or a local variable.
---------- Post updated at 12:10 PM ---------- Previous update was at 11:49 AM ----------
Quote:
Originally Posted by eponcedeleonc
the value of $host comes from a file that has names of servers..ie
server1
server1
server3
You also don't need to reopen the logfile n+1 separate times, you can just redirect the entire loop's output once.
And as I suspected, you're doing four ssh/scp things per loop which won't break it, but is going to make the script very slow; and causes all the problems you've been struggling with, like the inability to have a local variable on the remote server. I'd suggest a script like this instead:
Everything red is run only on the remote host. The green highlights how I'm getting the local HOSTNAME into the remote $1. (HOSTNAME is a variable that gets set for you by your shell.)
---------- Post updated at 12:29 PM ---------- Previous update was at 12:10 PM ----------
Okay I'm really done editing it now I think
Last edited by Corona688; 06-30-2011 at 04:28 PM..
Reason: many small improvements.
Hmm. Maybe your cfg2html command is printing useless chatter that ends up in the gz file? Try hexdump -C corrupted.gz | less to see if there's readable text on the top of it.
If there is, here's how you fix it.
Ignoring stderr up top there may not be necessary but this should cover all the bases. Put it back to 2>&1 once it works so you can get log messages out too.
Hello i'm trying to get the ip of a telnet session.
With who -u I get the hostname of the user connecting to my server, because it checks the reverse DNS. But I only want the ip.
Versions: HP-UX HP Release B.11.31
Who command: Hewlett-Packard Company - 4 - HP-UX 11i Version... (2 Replies)
Hi,
I am unable to get $HOSTNAME value in a remote script when executed through SSH. Also the scripts hangs and doesnt return to the calling environment.
For instance
command -
ssh user1@box2 "cd /var/home/bin ; ./generateScript.sh"
Can any one plese throw light on the issue and... (5 Replies)
Hi All,
So we added a new HP-UX 11.31 machine. Copied OS via Ignite-UX (DVD)over from this machine called machine_a. It was supposed to be named machine_c. And it is when you log in...however when I'm in the ILO console before logging in, it says:
It should say:
What gives? And how do... (4 Replies)
I was trying to execute the following command
ifConfig -a
and after a while my hostname changed to -a
I checked /etc/hosts and /etc/nodename all seems to be correct.
1. How my hostname changed to -a ? (What i could have done wrong)
2. if you type hostname where does solaris read... (1 Reply)
Hello,
I am new to Solaris.
I am using stand alone Solaris 10.0 for test/study purpose and connecting to internet via an ADSL modem which has DHCP server. My Solaris is working on VMWare within winXP. My WinXP and Solaris connects to internet by the same ADSL modem via its DHCP at the same... (1 Reply)
Dear All.
I will like to know beside the following command
"hostname hostname"
what other command that can change the hostname of the Unix.
Thanks. (4 Replies)
Using Solaris 8 (or WINXP).
I am trying to look up a specific DNS hostname, but I don't know which DNS server houses that entry. How can I find the hostname?
nslookup gives me the following:
C:\>nslookup hostname
Server: dnsserver
Address: x.x.x.x
*** dnsserver can't find hostname:... (2 Replies)
Hello,
I am installing redhat linux 6.2 on an intel based system. Whether i want to know any naming conventions should i follow.
ie Any convention to follow to name a linux machine(To give hostname). Simillarly for domain name also. Please suggest in this regard (1 Reply)