Sponsored Content
Top Forums Shell Programming and Scripting check for file existence on remote machine using sftp Post 302399944 by Scrutinizer on Tuesday 2nd of March 2010 02:26:58 AM
Old 03-02-2010
You could try to ftp 3Com_Files_Delivered.txt to your local host. From the subsequent presence of a copy of that file on your system you can conclude that transfer was successful. If not, then repeat after 5 minutes. If it was successful, then that is the green light to immediately start the transfer of the actual data file and delete the transferred copy of the indicator file. Perhaps there are more sophisticated methods, bit this is simple and the commands for both ftp transfers are almost identical.

Last edited by Scrutinizer; 03-02-2010 at 01:55 PM..
 

10 More Discussions You Might Find Interesting

1. SCO

Need Script to check whether user exists in the remote machine

Hi All, I am new to shell scripting. Can someone let me know, how to check whether the user exists in the remote system? I am building a new unix box and before I proceed installing the appliation , I want to check whether the required users are created in the system . how to do this ?... (1 Reply)
Discussion started by: Srini75
1 Replies

2. Shell Programming and Scripting

check for a file on a remote machine

Hi, Can someone tell me how to check if a file exists on a remote machine using rexec command?I'm using ksh. Thanks (3 Replies)
Discussion started by: Sheema
3 Replies

3. Red Hat

To find the LATEST file from a dir on REMOTE machine and SCP to local machine?

Hi All, URGENT - Please help me form a scipt for this: I need the LATEST file from a dir on REMOTE machine to be SCP'd to a dir on local machine. (and I need to execute this from local server) I know that the below cmd is used to find the LATEST file from a dir. But this command is not... (3 Replies)
Discussion started by: me_ub
3 Replies

4. Programming

Check if user logged into remote machine via C++ / Java

Hi, I have a program running on HP-UX and it must checkwhether a user has already logged-in to another machine. The hostname of the other machine is known when the check has to be made. Is there a way which this can be accomplished using C++ or Java? If not I could parse the output of a... (6 Replies)
Discussion started by: johnmmcparland
6 Replies

5. Shell Programming and Scripting

check web server running on local and on remote machine

Hi , How to check whether web server is running from remote machine How to check whether web server is running on web server itself Can any one help me soon (1 Reply)
Discussion started by: satheeshkr_cse
1 Replies

6. Shell Programming and Scripting

Check file exists on remote machine.

I am haveing one script haveing one issue with this could any one can reply soon it is very urgent. :p if ssh hcp_ftp@$1 'ls '$2/stop.txt' 1>&2 2>/dev/null'; then exit 1; else scp -p hcp_ftp@$1:$2/VAT*.dat $3 <<EOF EOF cd $3 pwd echo 'About to find file' SOURCE_FILE=$(ls -rt VAT*.dat|tail... (2 Replies)
Discussion started by: marpadga18
2 Replies

7. Ubuntu

I want to upload file on remote machine in noninteractive mode through SFTP

Hi All, I want to upload file through SFTP in non interactive mode on remote server. please tell me what will have to do in oreder to do SFTP . (1 Reply)
Discussion started by: kulbhushan
1 Replies

8. Shell Programming and Scripting

Polling for existence of file on remote host

I am polling a file on remote host. I have this code that works, but can't explain why it works. while user@remote.no-exist.com 'ls /user/app1/.done'` ] do echo Sleeping for 5 secs sleep 5; done This code works in the way that when the .done file exists on the remote host, the script... (1 Reply)
Discussion started by: starlatch
1 Replies

9. Solaris

unable to sftp to a remote server from Unix machine

Hi, I get the below when i try to sftp to a remote server $ export SOCKS5C_CONFIG=~/.ssh/socks5c.conf $ sftp -v -s /usr/lib/sftp-server -oPort=2222 -oIdentityFile=~/.ssh/wm_privat> Connecting to ftp01.wmgruppe.de... Sun_SSH_1.1.3, SSH protocols 1.5/2.0, OpenSSL 0x0090704f debug1:... (1 Reply)
Discussion started by: Bigbee
1 Replies

10. UNIX for Beginners Questions & Answers

SFTP file check through a remote host

Hi all, posting my first time, hope not breaking posting rules with it, if yes, let me know. I'm trying to build a script to check a file in an sftp server through a remote server. The intention is to check the file in a sftp host, and if the file is found or not, it should send an email.... (4 Replies)
Discussion started by: MrShinyPants
4 Replies
tftp(1) 						      General Commands Manual							   tftp(1)

NAME
tftp - Provides the Trivial File Transfer Protocol (TFTP) SYNOPSIS
Interactive form: tftp [remote_host] [port] Command-line form: tftp remote_host [port] -subcommand [args] DESCRIPTION
The tftp command transfers files between hosts using TFTP. Because TFTP is a minimal file transfer protocol, the tftp command does not pro- vide all of the features described under the ftp command. For example, tftp does not provide subcommands to list remote files or change directories at the remote host, and limited file access privileges are given to the remote TFTP server. Note that the tftp command is not available when your host is operating in controlled access (secure) mode. The remote host must have a tftpd server started by its inetd server and have an account defined that limits the access of tftpd. Use the tftpd command to set up the TFTP environment and the nobody account. The tftp command has two forms: interactive form and command line form. In the interactive form, tftp is issued alone or with a host argu- ment that specifies the default host to use for file transfers during this session. You can also specify a port for the tftp connection to use. When you enter the interactive form, the tftp> prompt appears. In the command line form, you specify command arguments on the com- mand line, and no prompt appears. The tftp command can overwrite a file, but prompts you before doing so. When transferring data to a remote host, the transferred data is placed in the directory specified by the remote_file argument. remote_file must be a fully specified filename, and the remote file must both exist and have write permission set for others. The tftp command attempts to write the data to the specified file. However, if the remote TFTP server does not have the appropriate privileges to write the remote file or if the file does not already exist, the transfer fails. SUBCOMMANDS
The tftp subcommands can be entered in either their interactive form or in their command line form. Displays help information. If a sub- command is specified, only information about that subcommand is displayed. Synonym for the mode ascii subcommand. Synonym for the mode binary subcommand. This subcommand is used in the interactive mode. The image mode is the same as mode binary, but is used on the command line. Sets the remote host, and optionally the port, for file transfers. Because the TFTP protocol does not maintain connections between transfers, the connect subcommand does not create a connection to host, but stores the settings for transfer operations. Because the remote host can be specified as part of the get or put subcommands, which overrides any host previously specified, the connect subcommand is not required. Transfers a file or set of files from the remote host to the local host. Each of the remote_file arguments can be speci- fied in one of the following two ways: As a file that exists on the remote host, if a default host was already specified. As host:file, where host is the remote host and file is the name of the file to copy to the local system. If this form of the argument is used, the host specified for the last transfer becomes the default host for subsequent transfers in this tftp session. In either case, remote_file must be a fully-specified filename. Toggles hash marks. Sets the transfer mode to ascii or binary. A transfer mode of ascii is the default. Sets mode to octet. Transfers a file or set of files from the local host onto the remote host. The remote_directory and remote_file arguments can be specified in one of the following two ways: As a file or directory that exists on the remote host, if a default host was already specified. As host:remote_file, where host is the remote host and remote_file is the name of the file or directory on the remote system. If this form of the argument is used, the host specified for the last transfer becomes the default host for subsequent transfers in this tftp session. In either of these cases, the remote filename or directory name must be a full pathname, even if the local and remote directories have the same name. If a remote directory is specified, the remote host is assumed to use UNIX pathname syntax. Exits tftp. An End-of-File also exits the program. Displays transfer rate information. Defines the retransmission time-out for each packet, in seconds. Shows the current status of tftp, including the current transfer mode (ascii or binary), connection status, time-out value, and so on. Sets the total transmission time-out to the number of seconds specified by value. Turns packet tracing on or off. Turns verbose mode, which displays additional information during file transfer, on or off. EXAMPLES
To enter tftp, check the current status, connect to host1, and transfer the file update from host1 to the local host, enter: $ tftp tftp> status Not connected. Mode: netascii Verbose: off Tracing: off Rexmt_interval: 5 seconds, Max-timeout: 25 seconds tftp> connect host1 tftp> get /u/alice/update update tftp> quit $ The get subcommand transfers the file update from the remote host to your local host. Note that the directory /u/alice on the remote host must have read permission set for others. To perform the same operation in command-line mode, enter: $ tftp host1 -status -get /u/alice/update update Connected to host1. Mode: netascii Verbose: off Tracing: off Rexmt_interval: 5 seconds, Max-timeout: 25 seconds To open a tftp connection to host1, set binary mode, transfer the file game.exe from the local host to host1, and rename the file in the process, enter: $ tftp host1 tftp> binary tftp> put game.exe /u/alice/tictactoe.exe The put subcommand transfers the file game.exe from your local host to the remote host as tictactoe.exe. Note that the directory /u/alice on the remote host must have write permission set for others. Also, the file tictactoe.exe must already exist on the server and have write permission set for others. To perform the same operation in command-line mode, enter: $ tftp host1 -binary -put game.exe /u/alice/tictactoe.exe To transfer two files from the local host to two remote hosts, enter: $ tftp tftp> put product.html pricelist.html host1:/u/alice/public_html tftp> put product.html pricelist.html host2:/public/documents The put subcommand transfers the files from your local host to the specified directory on each remote host. Again, the files and directories must already exist on the remote hosts and have write permissions set for others. When the file transfer is complete, the last host, host2, becomes the default host for subsequent transfers in this tftp session. To perform the same operation in command-line mode, enter: $ tftp host1 -put product.html pricelist.html /u/alice/public_html $ tftp host2 -put product.html pricelist.html /public/documents FILES
Defines the address of the local host, and specifies the names and addresses of remote hosts. Defines the sockets and protocols used for Internet services. SEE ALSO
Commands: ftp(1), ftpd(8), inetd(8), rcp(1), syslogd(8), tftpd(8) tftp(1)
All times are GMT -4. The time now is 12:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy