I am trying to create a ksh script to login to server and collect gather output of some command to troubleshoot some issue.
issue) My script is working upto marked arrow and it is prompting me for password and i am able to login to server, BUT command after that are not running.
pls gelp
I am beginner in scripting. This is ksh
Last edited by Corona688; 11-28-2012 at 02:50 PM..
running 'ssh' does not feed the rest of the script into ssh. It's a separate shell on a completely different system -- it's not reading your script.
If you want to feed a script into it, you have to feed a script into it. You can use what's called a "here-document" to effectively feed a file full of text into a program:
That's a complicated but thorough way to do what bipinajith is doing, except with complete, unaltered, unescaped scripts.
Note the ending EOF must be at the very beginning of the line, do not indent.
If it was <<EOF instead of <<"EOF", the shell would substitute variables inside for you. That's bad -- $OSVALUE would become a blank string immediately, before it even gets sent to the other side.
Also note that variables don't cross. It's a new program on another system, it won't know your variables if you don't tell them it. Note how I pass two variables into the remote script. You can have more of those, and they can be anything you want. They become $1, $2, and so forth.
Last edited by Corona688; 11-28-2012 at 03:13 PM..
I am trying to run an awk command inside of ssh and it is not working. These are AIX servers.
for i in `cat servers`; do ssh $i "/bin/hostname; df -g | awk '/dev/ && $4+0 > 70'"; done
server1
server2
server3
server4
I also tried these two methods and they did not work. It just seemed... (5 Replies)
hello Don Cragun sir, i am not able to run this command
awk 'NR==FNR{if($0~/^>/){i=substr($0,2);getline};a=a $0;next}{print ">" $1 ORS substr(a, $2, $3-$2+1)}' file1 FS=\\t file2
i searched do text you on twitter, facebook but i get no reply from over there so i post here.
---------- Post... (2 Replies)
I'm testing a C++ based application (HLR) in my solaris system.
Whenever i start the application remotely from some other solaris server using ssh command the application throws an error and goes down.
command i used:
ssh root@192.168.151.77 "./start_hlr.sh"
Below is the error observed :
... (1 Reply)
Hi all,
Is it possible to make this possible ?
$ echo $SKY_HOME
/var/sink/SKY
$ echo $SKY_HOME
/home/smily/SKY
$ ssh root@xyz "echo $SKY_HOME"
root@xyz 's password: ******
/home/smily/SKY wrong output
I was expecting the output as
/var/sink/SKY (3 Replies)
Hi All,
I want to get %cpu and %memory utilization for a given process id in HP-UX so am using the following commands
1)TOP -p <PID> am getting error message like Quitting top: pset 26323 doesn't exist,but when am using only TOP command without any options its working fine.
2)ps -e -o pcpu... (5 Replies)
when i run a command on ALOM via ssh i get following error
ssh root@10.23.12.51 showhosts
Password:
Waiting for daemons to initialize...
Daemons ready
shell: Invalid credentials
how can i run commands without actually loging to the sc (3 Replies)
Hello.
I am trying to run xclock on newly built solaris box - These are the steps I followed:
# DISPLAY=localhost:0.0
# export DISPLAY
# xclock
xclock: not found
# cd /usr/openwin/bin
# ./xclock
Error: Can't open display: localhost:0.0
#
Please suggest, what am i doing wrong?
Thank... (27 Replies)
how to run a command in different machie
in my case script will runs in solaries machine..
in one instance it has to run a command in different machine with different operating system ( linux ) using SSH command
i tried
ssh -l (login_name) (machine name/host ) " command "
but it is... (3 Replies)
How would I combine something like:
localserver# ssh remoteserver
remoteserver# find blah blah blah
into a one liner that would ssh to the remote server and run the find command, so I could put it in a script to automatically go out and run things on remote servers with out needed user... (2 Replies)