Connect to Server B from Server A and Archive the file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Connect to Server B from Server A and Archive the file
# 1  
Old 03-31-2010
Connect to Server B from Server A and Archive the file

Hi

I need to connect to a ServerB from Server A
eg: Server A : 172.20.273.51, un: xxx, pwd: xxx
Server B: 172.20.273.51, un:yyy, pwd: yyy

Need to copy the files(with name starts with IME*) from /grid/pc/IME*
to /grid/pc/archive
What will be the command or script to do the above process without prompting the passowrd.

Thanks in advance
Sheku

Last edited by pludi; 03-31-2010 at 06:42 AM..
# 2  
Old 03-31-2010
using expect you can do this . I have given a basic script. Change the variables username passwd as per ur setting and give try.

Code:
#!/usr/bin/expect
spawn telnet 172.21.149.155
  expect "login:"  
  send username\r
  expect "password:"
  send password\r
  expect "$"  
  send "copy /grid/pc/IME* /grid/pc/archive\r"
  expect "$"  
  send exit\r
  expect eof

# 3  
Old 03-31-2010
Quote:
What will be the extension of this script file name ?. is it like filename.expect instead of filename.ksh
Can you pls help me..

As i get error when the file name is "archive.ksh"

ksh: archive.ksh: not found


---------- Post updated at 05:31 AM ---------- Previous update was at 05:28 AM ----------

Quote:
My script file looks as below : archive.ksh
Is it correct what i am doing. Please suggest as i am new to shell script
Code:
#!/usr/bin/expect
spawn telnet 172.20.253.112
  expect "login:"  
  send cipxxx\r
  expect "password:"
  send sp144\r
  expect "$"  
  send "copy /dw/cdrsp/stage/velocity/rtf/input/SOH/dev/ISM_VME* 

/dw/cdrsp/stage/velocity/rtf/input/SOH/dev/archive\r"
  expect "$"  
  send exit\r
  expect eof



---------- Post updated at 05:43 AM ---------- Previous update was at 05:31 AM ----------

Please some help me. Its very urgent!
# 4  
Old 04-01-2010
the script can have any name

say you have archive.ksh

You can run it from your present location
Code:
$./archive.ksh

Or place the script in any of your PATH location.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to archive logs and sftp to another archive server

Requirement: Under fuse application we have placeholders called containers; Every container has their logs under: <container1>/data/log/fuse.log <container1>/data/log/fuse.log.1 <container1>/data/log/fuse.log.XX <container2>/data/log/fuse.log... (6 Replies)
Discussion started by: Arjun Goswami
6 Replies

2. Shell Programming and Scripting

How to connect from one server(Current) to another server?

Hi, I have something like this. I have connected to one server ServerA and from this ServerA, i need to do ssh connection to ServerB and then execute my queries. #!/usr/bin/expect spawn ssh Myusername@ServerB expect "password" send "Mypassword\r" interact Output.ksh: spawn: not... (5 Replies)
Discussion started by: Samah
5 Replies

3. Linux

How to connect Linux server (configure two way authentication) with Windows server?

Hi my name is Manju. ->I have configure the two way authentication on my linux server. ->Now I am able to apply two way authenticator on particuler user. ->Now I want to map this linux server to my AD server. ->Kindly tell me how to map AD(Active Directory) with this linux server. ... (0 Replies)
Discussion started by: manjusharma128
0 Replies

4. Shell Programming and Scripting

Connect to server-1 from server-2 and get a file from server-1

I need to connect to a ftp server-1 from linux server-2 and copy/get a file from server-1 which follows a name pattern of FILENAME* (located on the root directory) and copy on a directory on server-2. Later, I have to use this file for ETL loading... For this I tried using as below /usr/bin/ftp... (8 Replies)
Discussion started by: dhruuv369
8 Replies

5. Shell Programming and Scripting

Connect (SSH) to Windows server via Linux server through a script and passing command.. but failing

I am trying to connect to Windows server via Linux server through a script and run two commands " cd and ls " But its giving me error saying " could not start the program" followed by the command name i specify e g : "cd" i am trying in this manner " ssh username@servername "cd... (5 Replies)
Discussion started by: sunil seelam
5 Replies

6. UNIX for Advanced & Expert Users

Public key to connect from one ftp server to other server

How to generate public key to connect from one ftp server to other server to use in scripting. (1 Reply)
Discussion started by: sridhardwh
1 Replies

7. Linux

Generate public key to connect from one ftp server to other server

How to generate public key to connect from one ftp server to other server to use in scripting. (0 Replies)
Discussion started by: sridhardwh
0 Replies

8. Shell Programming and Scripting

Archive log Pull script from one server to another server

Hi all, Iam looking out for a shell script which pulls archive from Server A to Server B. And at the same time, we dont want the archives which are already pulled in Server B to be removed from Server A. Please help me on this, I have been trying on this for a quiet few time. ... (3 Replies)
Discussion started by: vivi.raghav
3 Replies

9. Windows & DOS: Issues & Discussions

bat file to connect UNIX server.

Hi, i am trying to connect to unix server from windows bat file using telnet command. But bat file is unable to pass username and password hence could not login to UNIX. My requirement is to connect UNIX server from .bat file and run few macros at a perticular schedule. My UNIX login does... (1 Reply)
Discussion started by: rahulbahulekar
1 Replies

10. Windows & DOS: Issues & Discussions

To Connect to Windows server from Unix server

Hi i am writing a script in unix where after some validations, i require the script to connect to a windows server and then kich off a batch file there. i tried ftp and got the error message that "the remote host refused an attempted connect operation". I am able to connect to this unix... (4 Replies)
Discussion started by: vidzz911
4 Replies
Login or Register to Ask a Question