Automate batchfile generation for sFTP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Automate batchfile generation for sFTP
# 1  
Old 04-26-2006
Automate batchfile generation for sFTP

Hey all,

I am writing a script for sFTP using batchfile option (-B). My script is supposed to monitor a certain directory for several files and when they are found I will send them to a testing server. So using a static batchfile wouldn't be feasible, I am just wondering if anyone can show me how to dynamically generate the batchfile (which I assume is simply a text file) when the file is found, then I can use it to invoke sFTP. Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sftp using batchfile - storing result local

I'm making an sftp-connection to a remote server. I want the result of an ls-command in a local file and the result of ls on another folder in another local file. Because everything has to go as fast a possible I wan't to do everyting in one connection. The command I use is : psftp -v -batch -b... (4 Replies)
Discussion started by: pistach
4 Replies

2. Shell Programming and Scripting

Sftp automate

hi, I am trying to automate a file download process using sftp. There is some logic to download files. 1) I need to login to destination server and then go to folder. 2) find list of files and count 3) using list of files I need to eliminate three selective files and download remaining... (1 Reply)
Discussion started by: getmilo
1 Replies

3. UNIX for Dummies Questions & Answers

Automate sftp process using script

Hi, guys, I am trying to automate a sftp process using "expect" method (since the key authentication method is disabled in my company network, there is no helping it). In order to try, I type in the command manually: sftp @ > << EOF >cd >ls -l >EOF >Connecting to @servername password: ... (3 Replies)
Discussion started by: warmboy610
3 Replies

4. UNIX for Dummies Questions & Answers

Help on commands in sftp using BatchFile

Hi, The script didn't continue as "20130109" folder is already created on the destination server. Please help. Entry in script: cat > $filebatch << __EOF__ mkdir $current_date mkdir $current_date/$fpdomain cd $current_date/$fpdomain ls -l __EOF__ Error: sftp -b... (12 Replies)
Discussion started by: chococrunch6
12 Replies

5. Shell Programming and Scripting

keypair generation for passwordless sftp

Hi, I want to establish a passwordless sftp between the two servers. I've searched the net and know the steps to be taken; which are as follows: $ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (~/.ssh/id_rsa): ~/.ssh/id_rsa already... (3 Replies)
Discussion started by: dips_ag
3 Replies

6. Shell Programming and Scripting

Using expect to automate sftp

I am trying to use a for loop in my expect cmdFile that I am calling. I want to be able to call either one file name or a series of file names in the working directory (that I won't know the names before hand) and then pass the names to the sftp program. Something like for i in (ls *txt) do (0 Replies)
Discussion started by: vedder191
0 Replies

7. Shell Programming and Scripting

sftp can't fine batchfile "No such file or directory"

Hi, I've got a C program that is using execlp to run a non-interactive sftp (using a batchfile) session to send some files to another system. Just before doing that, I create the batchfile called sftp_batch on the fly: V8_26_1:sun-->cat /workspace/sftp_batch cd /tmp/newsftp put test.file... (2 Replies)
Discussion started by: Fiaran
2 Replies

8. Shell Programming and Scripting

Passing variables: sftp using -b batchfile

Hi All, I have created a script for an sftp transfer that works without a date variable being passed, I want it to work with a date variable being passed. So, my initial script, mainsftp.sh, looks like this: ----------------------------------------------------------------------- #... (1 Reply)
Discussion started by: j_miller
1 Replies

9. Shell Programming and Scripting

Automate SFTP is not working

Hi All:cool:, i tried to automate SFTP process after passwordless authendication. Stil i am getting error... Can anyone help.... ------------------- sample code below ------------------- sftp -v $mdskk@100.4.4.75 << EOF cd /data mget *.tar.gz bye EOF... (2 Replies)
Discussion started by: senthil_seera
2 Replies

10. Shell Programming and Scripting

sftp -b doesn't read the batchfile

Several of our end-users need to send a file to our insurance carrier using ssh and sftp. We've put together a Windows VBS script that opens the ssh tunnel and calls sftp with the -b option pointing to a batch script in the same directory, however sftp doesn't seems to be reading from the... (1 Reply)
Discussion started by: kmw
1 Replies
Login or Register to Ask a Question
INNXMIT(8)						      System Manager's Manual							INNXMIT(8)

NAME
innxmit - send Usenet articles to a remote NNTP server SYNOPSIS
innxmit [ -A alt_spool ] [ -a ] [ -c ] [ -d ] [ -l ] [ -M ] [ -r ] [ -s ] [ -t timeout ] [ -T timeout ] [ -p ] [ -S ] [ -P portnum ] host file DESCRIPTION
Innxmit connects to the NNTP server at the specified host and sends it the articles specified in the batchfile named file. It is normally invoked by a script run out of cron(8) that uses shlock(1) to lock the host name, followed by a ctlinnd(8) command to flush the batchfile. If the file is not an absolute pathname, it is taken relative to the /var/spool/news/out.going directory. It is normally written by speci- fying the ``Wnm'' flags in the newsfeeds(5) file. Each line in the batchfile should be in one of the following formats: filename Message-ID filename The filename field names the article to be sent. If it is not an absolute pathname it is taken relative to the news spool directory, /var/spool/news. If the Message-ID field is not specified, it will be obtained by scanning the article. The filename and Message-Id fields are separated by a space. If a communication error such as a write(2) failure occurs, innxmit will stop sending and rewrite the batchfile to contain the current article and any other unsent articles. OPTIONS
-t Innxmit normally blocks until the connection is made. To specify a timeout on how long to try to make the connection, use the ``-t'' flag. -T To specify the total amount of time that should be allowed for article transfers, use the ``-T'' flag. The default is to wait until an I/O error occurs, or all the articles have been transferred. If the ``-T'' flag is used, the time is checked just before an article is started; it will not abort a transfer that is in progress. Both values are measured in seconds. -P To specify a port number other than the default, use the -P flag. -r If the remote server sends an unexpected reply code, innxmit will requeue the article and proceed. Use the ``-r'' flag if the arti- cle should not be requeued. -v Upon exit, innxmit reports transfer and CPU usage statistics via syslog(3). If the ``-v'' flag is used, they will also be printed on the standard output. -a If all articles were sent successfully, innxmit will remove the batchfile, otherwise it will rewrite it to contain the list of unsent articles. If no articles were sent or rejected, the file is left untouched. This can cause the batchfile to grow exces- sively large if many articles have been expired and there are communication problems. To always rewrite the batchfile, use the ``-a'' flag. -p If the ``-p'' flag is given, then no connection is made and the batchfile is purged of entries that refer to files that no longer exist. This implies the ``-a'' flag. -S If the ``-S'' flag is given, then innxmit will offer articles to the specified host using the ``xreplic'' protocol extension described in innd(8). The ``-S'' flag implies ``-s'', since streaming is not supported in the xreplic protocol. To use this flag, the input file must contain the history data (commas are transliterated to spaces by the server). In order for this flag to be used, the input must contain the necessary history entries. This is usually done by setting up a ``WnR'' entry in the newsfeeds file. -d Use the ``-d'' flag to print debugging information on standard error. This will show the protocol transactions between innxmit and the NNTP server on the remote host. -l The ``-l'' flag is used to turn off logging of reasons the remote gives for rejecting an article. -M If the ``-M'' flag is used then innxmit will scan an article's headers before sending it. If the article appears to be a MIME arti- cle that is not in seven-bit format, the article will be sent in ``quoted-printable'' form. -A The ``-A'' flag may be used to specify an alternate spool directory to use if the article is not found; this would normally be an NFS-mounted spool directory of a master server with longer expiration times. -s Innxmit will attempt to negotiate a streaming mode extension of the NNTP protocol with the server at connect time. If successful it will use a slightly different protocol that enhances throughput. If the server does not recognize the streaming mode negotiation innxmit will revert to normal NNTP transfer mode. Use the ``-s'' flag to disable the attempt to negotiate the streaming mode exten- sion. -c In streaming mode a check of each message ID is still made to avoid sending articles already on the server. The ``-c'' flag will, if streaming mode is supported, result in sending articles without checking. This results in slightly greater throughput and may be appropriate when it is known that the site could not already have the articles such as in the case of a "leaf" site. HISTORY
Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews. This is revision 1.19, dated 1996/12/10. SEE ALSO
ctlinnd(8), innd(8), newsfeeds(5), shlock(1). INNXMIT(8)