I'm trying to write a shell script using bash that connects to a remote server, runs a command that generates a file, pulls the file over, then renames it with the hostname of the remote server and a an extension.
So far, I'm able to everything but pull the hostname of the remote server into a variable.
returns:
ssh root@192.168.1.1 hostname
When I run the command from the prompt, it returns what I am looking for. I also tried:
and i had similar results, where the contents of the ' were returned.
Hi all,
i'm trying to gether multiple pattern on remote hosts, and trying to print hostname and the pattern,
ssh remoteserver1 -C 'hostname 2>&1;cat /var/log/server1.log | awk -F ";" '"'"'{ print " "$2" "$5}'"'"'| sort | uniq -c | sort -g -r '
The output is the following,
remoteserver1
... (8 Replies)
Hi
How to pass echo output to a variable ?
Does below awk command will get the last character of hostname and assign to a variable - "svr" ?
svr=$( echo `hostname` | awk '{print substr($0,length,1)}' )
Thanks.
Please use CODE tags when dsplaying code segments, sample input, and sample... (7 Replies)
I am trying to cat on a file located on remote server and assign it to remote variable.
I have both local and remote variables. Running below script from local. test.sh
J_NAME=XXX2
J_IP=XXX
ssh $J_IP "ps auxw |grep java | grep -v grep |grep $J_NAME | awk '{print ... (2 Replies)
I know the ipaddress of a remote machine and would like to know its hostname
I used the nslookup command but... is there an easier way of doing it... just like hostname command.
When i give this command i get the following
nslookup 10.2.47.36
Server: 10.233.04.31
Address: ... (2 Replies)
Hola -
I've got a script for logon which populates a database with some info when a user logs on so that we can tell how many public terminals are in use & show users which ones are free. However, the machines are DHCPed and so using $HOSTNAME gives me an unstable name for them since of course... (3 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)
Hi,
Can anyone please tell me whether we can pull the file from the remote server tru FTP, with the same date the file is available in remote server?
Thanks,
Punitha (1 Reply)
I have a variable embedded in a long string called "commands" coming in on a query_string. I need to copy the string to a file with the variable $loop1 converted before it writes. Right now, it writes the varible itself instead of what it should be.
QUERY_STRING... (2 Replies)
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)
Hello..
Here is a small doubt....
I need to assign root@hostname to variable..
where hostname is the system variable...
when i give variable="root@$hostname"
its not working...
pls help..me
thanks in advance
esham (4 Replies)