Results 1 to 5 of 5
Hi all,
I am trying to write a script which login to a remote machine and executes some command, wait till they are executed and continue processing the current script. ...
- 06-25-2007 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 4
Executing the script in Remote System
Hi all,
I am trying to write a script which login to a remote machine and executes some command, wait till they are executed and continue processing the current script. I am not able to do this.
#This is the way i tried
if [#1 eq qa] ; then
sudo su xyz@ax01.xyz.com
cd /test/script
./runtheScript
fi
But when i try to execute the above script. It gives me an error that the script is not found. Also how could i sepecify the password for the xyz user so that he could log on sucessfully. I also want to know whether the command executing in the remote is finished? Can anyone help me in writing the script. Thanks in Advance.
Regards,
Arul.
- 06-26-2007 #2Linux User
- Join Date
- Jan 2007
- Location
- cleveland
- Posts
- 452
have you considered kermit?
the communications package (from Columbia University) has a very
powerful scripting language designed precisely to automate such
doings as you suggest: logging in remotely, giving passwords,
running programs remotely, downloading the results &c
for linux, you want "C-kermit"the sun is new every day (heraclitus)
- 06-26-2007 #3Linux Enthusiast
- Join Date
- Jul 2005
- Location
- Maryland
- Posts
- 521
You can use "expect" to do what you want.
You will probably have to install it first:
orCode:yum install expect
depending on your distro.Code:apt-get install expect
However, a better way would be to setup SSH server and use public key authentication as Thrillhouse suggested here
- 06-26-2007 #4Just Joined!
- Join Date
- Jun 2007
- Posts
- 4
Thanks a lot. Will try it out.
Regards,
Arul.
- 06-26-2007 #5
As noted, I believe SSH is the ideal solution. And using keychain allows you to only type in your passphrase once per login.
Currently, I routinely execute commands like this:I also have entries in my ~/.ssh/config file so ssh knows what username to use on the remote host.Code:ssh webhost 'cd public_html; ls -l'


Reply With Quote