Unable to automate SSH in Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unable to automate SSH in Script
# 1  
Old 09-10-2012
Bug Unable to automate SSH in Script

Hi

I have a script at Server B. I want to run it from server A via another script. I tried the following command. ssh mss@247.123.456.123 "sh pm10.sh"

It's getting login automatically, but while running the script through error like "reppar: command not found" where reppar is an application installed in the remote machine. I am able to run the same script via manual ssh. But unable to do via script. Please help
# 2  
Old 09-11-2012
It might be missing from the PATH, running it directly may prevent it doing an actual shell login and getting your usual shell variabies. something like ssh username@host . /etc/profile ';' mycommand could rectify that
# 3  
Old 09-11-2012
Hi Corona688

yes, but it's not a single command. A set of commands inside the script. Can you please set me know how to update the PATH variable of remote machine?
# 4  
Old 09-11-2012
MySQL

Please try in the below format.

Quote:
ssh mss@247.123.456.123 ". /etc/profile;sh pm10.sh"
or even u can export the path

Quote:
ssh mss@247.123.456.123 "export PATH=$PATH:/usr/bin/sbin; sh pm10.sh"
# 5  
Old 09-12-2012
Thanks a lot. It works.....

---------- Post updated at 11:02 AM ---------- Previous update was at 11:01 AM ----------

Thanks a lot. It works...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Automate or 1 line command for ssh-keygen -t rsa

I know there's an echo 1 liner command that will do a new line for me, I think same with fdisk too. Dont want to press "enter,enter,enter" just to finish the ssh-keygen -t rsa. Hope you understand what i mean here. Thanks ssh-keygen -t rsa Generating public/private rsa key pair. Enter... (1 Reply)
Discussion started by: invinzin21
1 Replies

2. Shell Programming and Scripting

Automate OTPW login to ssh via bash script

Hello everyone. I'm a Linux novice trying out a lot of bash scripting lately, as it is so very addictive. Lately I have been setting up one of my boxes remotely and have been hardening it as much as possible. Please allow me to explain the scenario, as it does tend to become a little... (1 Reply)
Discussion started by: instro
1 Replies

3. Shell Programming and Scripting

Unable to automate telnet login

i have to connect windows server from one of the unix box so i am using telnet and below is my following code #!/bin/sh host=hostname log=loginid port=23 pass=password cmd1=mkdir test1234 ( echo open ${host} ${port} sleep 1 echo ${log} sleep 3 echo "\r\n" sleep 3 echo ${pass}... (11 Replies)
Discussion started by: chandan.p
11 Replies

4. HP-UX

Unable to connect SSH from HP-UX

Hi, I'm trying to connect from an HP-UX with SSH2 client(ssh2 3.1.2 on hppa1.1-hp-hpux11.00) to an SSH2 server on a VxWorks system. The SSH connection is failing with the below connection logs: > /usr/local/bin/ssh2 -v -l testuser 10.10.10.10 debug: Ssh2/ssh2.c:1391: Using file... (4 Replies)
Discussion started by: ysafi
4 Replies

5. Shell Programming and Scripting

How to automate SSH remote connection with a shell script

Hi Guys! I am trying to write a shell script for automated ssh. vairable user and passwd have initialized correctly, but when I use the following it still prompting me for the password. #!/usr/bin/bash user='root@10.14.76.225' passwd='admin' ssh $user $passwd uptime exit I... (3 Replies)
Discussion started by: pinpe
3 Replies

6. AIX

Automate ssh between different flavours of ssh

Hiya, I want to automate ssh between two servers (Server A and Server B) and currently facing two problems. I am able to automate ssh between same SSH versions but unable to do so for following conditions. 1. SSH versions are different on Server A and Server B. 2. Username is different on... (1 Reply)
Discussion started by: kamitsin
1 Replies

7. Shell Programming and Scripting

Expect Script to Automate SSH

How would I write an expect script to automate ssh and what file extention do expect files use? (11 Replies)
Discussion started by: Prodiga1
11 Replies

8. UNIX for Advanced & Expert Users

Automate with Putty-SSH for 2 users

Hi, I have automated logins to Unix boxes with Ssh - Putty combination. Have created a Pub - Pvt key combination for the same. Added the entry of username in "User name" box of Putty. This works perfectly for the specified user. I want this to happen now for another user as well, without... (0 Replies)
Discussion started by: vibhor_agarwali
0 Replies

9. HP-UX

Unable to install SSH

Hello!! I have an HP-UX 11.23 box. I downloaded an SSH depot file form HP website. Using SAM, I tried to install the depot file. However, SAM declared "it cannot find any compatible depot file to install". Due to that, I tried using command line 'swinstall' just like HP tutorial taught me.... (8 Replies)
Discussion started by: jembalang
8 Replies

10. AIX

Unable to ssh out

As the title says, I'm unable to ssh out of boxA to other nodes on the network. I am running 5.2 ML6. The version of ssh client is: openssh.base.client 4.1.0.5301 COMMITTED Open Secure Shell Commands The program installed okay with no errors. When I try to ssh to another node on... (6 Replies)
Discussion started by: outtacontrol
6 Replies
Login or Register to Ask a Question