Sponsored Content
Top Forums Shell Programming and Scripting Issues with automating SFTP command Post 302586863 by krackjack84 on Tuesday 3rd of January 2012 01:23:25 PM
Old 01-03-2012
Error Issues with automating SFTP command

Hi All,

I am currently looking at automating the steps that I follow to download log files from putty to desktop.

I connect to a client's machine through citrix desktop. I am required to download quite a number of application logs to identfiy the issues in production.

Steps that is being followed now:
1. open putty.exe enter the host name or ip address(art01.wrs.aps-bcs.org)-- this is a stepping stone server
2. Once I click on okay. I get a prompt window with a message login as, after I enter the user name I enter the password.
3. Next I see a "bash >" Now I enter the box to which I have to connect to. It would look like bash> sftp cdsapptl01
4. Now I am asked to enter the password. After that I will have to enter the path of the log file and do a mget.
5. I connect to toad and move the file from server to desktop

So far so good.

I am looking at automating the above steps so that I can run a .bat file to perform the operation.

What I've done so far:

Created a test.bat, it would look like:
CALL putty.exe -load art01.wrs.aps-bcs.org -l username -pw password

When I run this batch file I am directly on to step 3. Makes me feel proud that I got thus far given the fact that I havent worked on scripting or unix.

Next I modified the test.bat to look like :
CALL putty.exe -load art01.wrs.aps-bcs.org -l username -pw password -m command.txt
the command.txt would look like this:
sftp cdsapptl01 (I also tried adding the password to this server in the same line i.e., sftp cdsapptl01 -pw password)

In both the cases what hapens is the prompt window ges closed automatically.

I am looking at the next steps now. I need to add the sftp cdsapptl01 and the password and its path lastly the mger command to download the log file.

So when I run the batch file it should call the command.txt and all the lines should be executed including the mget so that the log file is downloaded.

Can someone please help me in this regard?I am required to complete this task by 9th January. Any help is highly appreciated. Thanks in advance!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

automating sftp script

I have to write an automated sftp script which uses password authentication method to access the remote server. I want to pass the password as a parameter or to be included in the script itself, so that when i run the sftp script, it should not prompt me to enter the password. Thanks in advance... (1 Reply)
Discussion started by: Rajeshsu
1 Replies

2. Shell Programming and Scripting

Automating SFTP with Expect

Hello all, I've written an automated SFTP script to work with the Expect command. It recently occurred to me however, that if the client side box does not have the known host entry for the server, it will not work correctly. So I have added an expect for the known host prompt, and that part... (2 Replies)
Discussion started by: sysera
2 Replies

3. Linux

sftp stalling issues.

Hello, I'm new to linux/unix and presently at my work i have wrote a script that goes out from a unix host connects to a transfer proxy using sftp (username & password) with internal IP address as scp is disabled on the server.. Now my problem is that when i try and get a bigger file sftp will... (1 Reply)
Discussion started by: est
1 Replies

4. Shell Programming and Scripting

SFTP / UNZIP script issues

Hi everyone, i'm having a little trouble wih my first shell script ever. So the point of that script is to: -Archive Zip files in a directory -Remove txt files from that directory -connect through sftp and a rsa key to a remote server -download a couple of files -unzip downloaded files ... (0 Replies)
Discussion started by: Peanutz
0 Replies

5. Solaris

Issues with automating SFTP

Hi We are trying to set up a non-interactive sftp to one of our clients to be able to transfer files to them. For the setup I logged into server1 as user1 and generated RSA public and private keys id_rsa and id_rsa.pub. Then I did an sftp to server2 as user2 and put the id_rsa.pub in the .ssh... (4 Replies)
Discussion started by: vnparo
4 Replies

6. Shell Programming and Scripting

Problems when automating sftp

Hi Guys, I am working on a shell script, which gets log files from a windows machine. Problem: 1. My server doesn't support FTP, so i am using SFTP 2. I am not able to automate sftp using public key generation technique, because i need to access many windows machines using this script. ... (0 Replies)
Discussion started by: rajhydprag
0 Replies

7. Shell Programming and Scripting

Automating 'newgrp' command - how?

Hi, I have to add the 'newgrp' command to my login (.cshrc) script. The problem is that if I add it, it comes to infinite look, since newgrp opens new shell again and again. How to automate the newgrp when I have to login, and avoid that loop? Currently I'm thinking of a condition that... (2 Replies)
Discussion started by: moshmosh
2 Replies

8. Shell Programming and Scripting

SFTP issues

Hi All, To transfer the files, from one server to another through SFTP, i am using below code in my script. cur_dt=$1 echo "cd /inbox/" >> SFTP.txt # folder of traget server echo "mput /opt/myfile/inbox/*_${cur_dt}_*.* " >> SFTP.txt # to get files from /opt/myfile for given date and... (1 Reply)
Discussion started by: Amit.Sagpariya
1 Replies

9. UNIX for Dummies Questions & Answers

Problem automating sFTP transfer using script in cron

Hi Newbie here I am having problems with automating sFTP transfers. Just to save time - SCP is not an option as sFTP is stipulated by controllers of far end server. Ineed to automate sFTP transfer of a single file, once a day to a remote server to which i have no control over. I am using:... (6 Replies)
Discussion started by: robbien
6 Replies

10. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies
UPDATE-DESKTOP-DATABASE(1)				      General Commands Manual					UPDATE-DESKTOP-DATABASE(1)

NAME
update-desktop-database - Build cache database of MIME types handled by desktop files SYNOPSIS
update-desktop-database [-q|--quiet] [-v|--verbose] [DIRECTORY...] DESCRIPTION
The update-desktop-database program is a tool to build a cache database of the MIME types handled by desktop files. The cache database contains the list of MIME types that can be handled by desktop files, as well as, for each MIME type, a list of desktop files that can handle this MIME type. This cache database ease the work of applications that need to find an application that can open a document of a specific MIME type: those applications will not have to parse all the desktop files existing on the system, and can instead parse this cache database. If no DIRECTORY is specified as argument, the desktop files that will be processed are the ones installed in $XDG_DATA_DIRS/applications. If both the --quiet and --verbose options are used, then --verbose will be ignored. OPTIONS
The following options are supported: -q, --quiet Do not display any information about processing and updating progress. -v, --verbose Display more information about processing and updating progress. NOTES
If an invalid MIME type is met, it will be ignored and the creation of the cache database will continue. The format of the cache database is a simple desktop entry format, with a MIME Cache group, containing one key per MIME type. The key name is the MIME type, and the key value is the list of desktop file that can handle this MIME type. The order of the desktop files found for a MIME type is not significant. Therefore, an external mechanism must be used to determine what is the preferred desktop file for a MIME type. EXAMPLE
Here is a simple example of a cache database: [MIME Cache] application/x-shellscript=gedit.desktop; text/plain=gedit.desktop;gvim.desktop; video/webm=totem.desktop; This cache database is created with three desktop files, each containing a MimeType key: gedit.desktop: MimeType=text/plain;application/x-shellscript; gvim.desktop: MimeType=text/plain; totem.desktop: MimeType=video/webm; FILES
$XDG_DATA_DIRS/applications/mimeinfo.cache This file is the cache database created by update-desktop-database. BUGS
If you find bugs in the update-desktop-database program, please report these on https://bugs.freedesktop.org. FREEDESKTOP.ORG UPDATE-DESKTOP-DATABASE(1)
All times are GMT -4. The time now is 12:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy