Sponsored Content
Full Discussion: Help in automation...
Top Forums Shell Programming and Scripting Help in automation... Post 302242880 by nua7 on Friday 3rd of October 2008 06:52:33 AM
Old 10-03-2008
Question

Hi guys,
The script is working fine without any errors. The only problem that I have now is the command that I am setting as a variable is not being executed on the linux server. Can someone please have a look.

Expect script:

Code:
#!/usr/bin/expect

set timeout 1
set cmd date

spawn ssh root@$argv
expect_after eof { exit 0 }

## interact with SSH
#expect "yes/no" { send "yes\r" }
expect "password:" { send "rootpasswd\r" }

expect "# "
send "$cmd\r"
expect "$cmd\r"
expect "(.*)\r"
send "exit\r"

Shell script

Code:
#!/bin/bash
# Linux/UNIX box with ssh key based login
# SSH User name
USR="root"

# connect each host and pull up user listing
for host in `cat list`
do
./sshtest.exp $host
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help need for automation of su command

Hi All! I need to automate the su command using expect script.Suppose I login as a user A , I need to change the user to oracle using the su oracle command and execute the command "sqlplus -ver". I tried writing a expect script for the same , but can't figure out the reason it is not working. ... (1 Reply)
Discussion started by: nua7
1 Replies

2. Shell Programming and Scripting

UNIX automation

Hello People, I have an outstanding issue with me I have 5 files at location /usr/abc called 1.DE 1.TXT 2.DE 2.TXT 3.DE 3.TXT 4.DE 4.TXT 5.Fe.ok My work involves few manual process like transfer 1.DE 1.TXT and 5.Fe.ok to /usr/dob location and run one script(for example -... (42 Replies)
Discussion started by: j_panky
42 Replies

3. Shell Programming and Scripting

Scripting for automation

Hi, I would like to know about a automated script which would collect data on a regular day to day basis at a particular time and stores it in a defined path for business analysis. Any help on this is highly appreciable!! Thanks Sara (6 Replies)
Discussion started by: sara23
6 Replies

4. UNIX for Dummies Questions & Answers

password automation

i am doing automation of report in unix. i am copying files from different server using scp command.. if i use scp its asking for password for copying files..is there any way to automate this password issue.. can anyone help me out??? tahnks in advance, Arun Manas (4 Replies)
Discussion started by: arunmanas
4 Replies

5. Shell Programming and Scripting

Tar automation

Hi, i'm new in shell programming, i would like to archive automatically all my log files at the end of each month. My files have this format : 2011.07.log1 2011.07.log2 ... 2011.08.log1 2011.08.log2 ... etc I would like to have an idea about how to do this. Thanks. (2 Replies)
Discussion started by: thedriver
2 Replies

6. Shell Programming and Scripting

Automation of UI using shellscript

Hi, I want to do automation on UI using shellscript. eg: 1) Drop down menu contains assign , investigate, closed. now there is one id want assign it using assign tab then need to investigate it and lastly close. Sometimes the id can't assign to perticular user. there are so many... (11 Replies)
Discussion started by: aish11
11 Replies

7. Shell Programming and Scripting

scp automation

hi there , i want to use the scp to transfer the file from one machine to another machine non-stop. i have put it in a .sh file. but everytime i run it and it prompts me to input password. pc3@pc3-desktop:~/Documents$ ./sample3.sh pc-main@192.168.1.117's password: screenshot.jpg ... (4 Replies)
Discussion started by: Ericyue
4 Replies

8. UNIX for Advanced & Expert Users

Need help in automation

Hi, I wanted to automate the scp command where i do not want to enter the password each time. So thought of using expect command. Script is executing without any issues but files are not copied to remote server. Can any one help me? Below is my shell script.. #!/bin/ksh ... (6 Replies)
Discussion started by: balasubramani04
6 Replies

9. Shell Programming and Scripting

automation using python

Im trying to write an automation script using python. I expect this script to log in to a remote server, execute commands and get its output. import pexpect child=pexpect.spawn('ssh myuser@192.168.151.80') child.expect('Password:') child.sendline('mypassword') get_output =... (4 Replies)
Discussion started by: Arun_Linux
4 Replies

10. Shell Programming and Scripting

Script Automation

Hi Gurus, I have a clearcase script that i use to check in a single file at time on my clearcase server. the script is as follows setmyview settask 75098_MSI_TRILOGY_EIM cd /vobs/Trilogy_R12/custom/msieim/12.0.0/sql/ cleartool co -nc . ct mkelem -nc Filename_1.sql cp... (3 Replies)
Discussion started by: r_t_1601
3 Replies
SSH-ARGV0(1)						    BSD General Commands Manual 					      SSH-ARGV0(1)

NAME
ssh-argv0 -- replaces the old ssh command-name as hostname handling SYNOPSIS
hostname | user@hostname [-l login_name] [command] hostname | user@hostname [-afgknqstvxACNTX1246] [-b bind_address] [-c cipher_spec] [-e escape_char] [-i identity_file] [-l login_name] [-m mac_spec] [-o option] [-p port] [-F configfile] [-L port:host:hostport] [-R port:host:hostport] [-D port] [command] DESCRIPTION
ssh-argv0 replaces the old ssh command-name as hostname handling. If you link to this script with a hostname then executing the link is equivalent to having executed ssh with that hostname as an argument. All other arguments are passed to ssh and will be processed normally. OPTIONS
See ssh(1). FILES
See ssh(1). AUTHORS
OpenSSH is a derivative of the original and free ssh 1.2.12 release by Tatu Ylonen. Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt and Dug Song removed many bugs, re-added newer features and created OpenSSH. Markus Friedl contributed the support for SSH protocol versions 1.5 and 2.0. Jonathan Amery wrote this ssh-argv0 script and the associated documentation. SEE ALSO
ssh(1) Debian Project September 7, 2001 Debian Project
All times are GMT -4. The time now is 11:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy