Sponsored Content
Full Discussion: run command with ssh[solved]
Top Forums Shell Programming and Scripting run command with ssh[solved] Post 302599372 by linuxadmin on Friday 17th of February 2012 02:07:34 AM
Old 02-17-2012
run command with ssh[solved]

Hi all,

Is it possible to make this possible ?

Code:
[smily@xyz ~]$ echo $SKY_HOME
/var/sink/SKY

[smily@abc ~]$ echo $SKY_HOME
/home/smily/SKY

[smily@abc ~]$ ssh root@xyz "echo $SKY_HOME"
root@xyz 's password: ******
/home/smily/SKY wrong output [for me , it's wrong ]

I was expecting the output as
/var/sink/SKY

.

---------- Post updated at 12:37 PM ---------- Previous update was at 12:04 PM ----------

Yep. I got it.

Code:
In xyz
=====
I made a shell script : /var/scripts/printEnv.sh
#!/bin/bash
source /etc/profile
echo $SKY_HOME

In abc
=====
[smily@abc ~]$ ssh root@xyz "sh /var/scripts/printEnv.sh"
root@xyz 's password: ******
/var/sink/SKY correct output [ As expected. ]


Last edited by linuxadmin; 02-20-2012 at 01:40 AM.. Reason: Wrongly given the answer. sorry. Now corrected.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How do I get ssh to run a command in one line?

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)
Discussion started by: LordJezo
2 Replies

2. Shell Programming and Scripting

how to run a command in different machine using SSH

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)
Discussion started by: mail2sant
3 Replies

3. Solaris

Run command on sc via ssh

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)
Discussion started by: fugitive
3 Replies

4. Shell Programming and Scripting

[solved] Killing 3rd command in ssh chain

Hi All, Noob question here... How do I kill the 3rd command in this ssh chain effectively? # ssh -t -t 10.80.0.5 'ssh 10.80.0.6 | /var/tmp/some_script' The "/var/tmp/some_script" contains: ssh 10.80.0.81 'echo "Hello World!!!!" >> /tmp/sample.txt'The problem is that once the sample.txt... (2 Replies)
Discussion started by: NYG71
2 Replies

5. Shell Programming and Scripting

Run perl command in script[solved]

Hi all, When I put the Perl command in a script, I got error. system("perl -pi -e 's@words@words@g' myFile"); The error is: Unrecognized character \x8A; marked by <-- HERE after دت مد�<-- HERE near column 15 at -e line 1. Thanks in advance. ---------- Post updated at 06:30 AM... (0 Replies)
Discussion started by: Lham
0 Replies

6. Shell Programming and Scripting

[SOLVED] put dd | ssh command in backgound

Greetings, I have an issue that has baffled me. I have done many searches, read the man documentation, and I have yet to find a solution. I am trying to run the following command within a script to copy a file across servers: $(dd if="$FDIR" bs=1024 2> /dev/null | ssh "$(whoami)@$SERVER"... (5 Replies)
Discussion started by: unaligned
5 Replies

7. Shell Programming and Scripting

Unable to run command after ssh

Hello, I am trying to create a ksh script to login to server and collect gather output of some command to troubleshoot some issue. DATE=`date +%b.%d.%Y.%M.%H` echo " Enter emp id to login to server" read Eid Eid=$Eid echo " Enter hostname of the system" read HOST HOST=$HOST... (2 Replies)
Discussion started by: saurabh84g
2 Replies

8. Shell Programming and Scripting

Script for telnet and run one command kill it and run another command using while loop

( sleep 3 echo ${LOGIN} sleep 2 echo ${PSWD} sleep 2 while read line do echo "$line" PID=$? sleep 2 kill -9 $PID done < temp sleep 5 echo "exit" ) | telnet ${HOST} while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies

9. Shell Programming and Scripting

[solved] Process ssh command in while loop

I have a script that reads a file containing a list of server names. It's suppose to loop through the list of names and execute a command on the remote server using ssh. It processes the ssh command for the first server in the list and then exits. Here's the code: #!/bin/bash ... (2 Replies)
Discussion started by: westmoreland
2 Replies

10. UNIX for Advanced & Expert Users

Run awk command inside ssh

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)
Discussion started by: cokedude
5 Replies
Net::GPSD3::Return::SKY(3pm)				User Contributed Perl Documentation			      Net::GPSD3::Return::SKY(3pm)

NAME
Net::GPSD3::Return::SKY - Net::GPSD3 Return SKY Object SYNOPSIS
DESCRIPTION
Provides a Perl object interface to the SKY object returned by the GPSD daemon. An example JSON object: Protcol 3.1 versions { "class":"SKY", "tag":"MID4", "device":"/dev/ttyUSB0", "time":1253593665.430, "hdop":23.60, "reported":9, "satellites": [ {"PRN":15,"el":77,"az":123,"ss":0, "used":false}, {"PRN":18,"el":25,"az":268,"ss":0, "used":false}, {"PRN":27,"el":13,"az":150,"ss":0, "used":false}, {"PRN":29,"el":47,"az":228,"ss":0, "used":false}, {"PRN":5, "el":39,"az":58, "ss":46,"used":true }, {"PRN":21,"el":41,"az":309,"ss":33,"used":true }, {"PRN":10,"el":32,"az":61, "ss":40,"used":true }, {"PRN":8, "el":12,"az":48, "ss":40,"used":true }, {"PRN":2, "el":9, "az":124,"ss":0, "used":false} ] } Protcol 3.4 versions { "class":"SKY", "tag":"0x0120", "device":"/dev/cuaU0", "xdop":0.58, "ydop":0.96, "vdop":1.92, "tdop":1.14, "hdop":1.90, "gdop":2.93, "pdop":2.70, "satellites":[ {"PRN":17,"el":76,"az":174,"ss":34,"used":true}, {"PRN":28,"el":57,"az":38,"ss":30,"used":false}, {"PRN":27,"el":22,"az":314,"ss":18,"used":true}, {"PRN":7,"el":15,"az":127,"ss":29,"used":true}, {"PRN":15,"el":31,"az":297,"ss":27,"used":true}, {"PRN":11,"el":18,"az":54,"ss":28,"used":false}, {"PRN":24,"el":18,"az":63,"ss":29,"used":false}, {"PRN":9,"el":4,"az":313,"ss":18,"used":false}, {"PRN":8,"el":45,"az":117,"ss":33,"used":true}, {"PRN":26,"el":49,"az":245,"ss":37,"used":true}, {"PRN":4,"el":5,"az":170,"ss":17,"used":false}, {"PRN":138,"el":44,"az":157,"ss":40,"used":true} ] } METHODS PROPERTIES
class Returns the object class string Returns the JSON string parent Return the parent Net::GPSD object device tag time timestamp datetime reported Count of satellites in view used Count of satellites used in calculation satellites Returns a list of satellite data structures. my $satellites=$sky->satellites(); #[{},...] my @satellites=$sky->satellites(); #({},...) Satellites Returns a list of Net::GPSD3::Return::Satellite objects. my @satellites=$sky->Satellites; #(bless{},...) my $satellites=$sky->Satellites; #[bless{},...] BUGS
Log on RT and Send to gpsd-dev email list SUPPORT
DavisNetworks.com supports all Perl applications including this package. Try gpsd-dev email list AUTHOR
Michael R. Davis CPAN ID: MRDVT STOP, LLC domain=>michaelrdavis,tld=>com,account=>perl http://www.stopllc.com/ COPYRIGHT
This program is free software licensed under the... The BSD License The full text of the license can be found in the LICENSE file included with this module. SEE ALSO
Net::GPSD3, DateTime, Net::GPSD3::Return::Unknown perl v5.14.2 2011-11-09 Net::GPSD3::Return::SKY(3pm)
All times are GMT -4. The time now is 03:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy