Thanks, but I don't understand. The ftp command is a "put" from the outside (client) machine, using .netrc. The cp command is on the receiving (server) side. I don't see how to run the cp command from the ftp client.
I guess I could do it as a pull from the receiving side which would make the recipient machine the client, but that wouldn't solve the problem because the ftp would then "get" an incomplete file if it were still being written to disk on the server. Or are you saying there's a "cp" command in ftp? I couldn't find it. However... After a quick search of the intertubes, it was pointed out that ftp *does* have a "rename" function. Thus, one can put the file to xxx.incomplete, and then rename it to xxx.jpg upon completion. The script on the recipient side then will not work unless the complete file is present. Thus my .netrc file looks like: machine <blog machine> login <userid> password <password> macdef init cd /picdir prompt off put tmp.jpg tmp.part rename tmp.part tmp.jpg quit That seems to work... billo On Tue, 1 Jun 2010, Jeremiah Bess wrote:
Combine the ftp and copy commands in a single script, and use a double-ampersand &&. This will run the second command only after the first has been completed successfully. ftp <insert your commands> && cp <insert your commands> Jeremiah E. Bess Network Ninja, Penguin Geek, Father of four On Tue, Jun 1, 2010 at 09:16, Bill Oliver <[email protected]> wrote: I have a webcam set up at a distant location. It ftps my server an image every minute. I have a script set up that copies the image to an archive and to a web page, e.g. #!/bin/sh cp tmp.jpg archives cp tmp.jpg /var/www/blog/pics This runs into a synchronization problem as you might expect -- sometimes the file gets copies before the ftp is finished, resulting in an incomplete picture being archived. Is there an easy way to test to see that an ftp has completed? I could run a look looking at changes in filesize, I suppose, but it seems there should be a more elegant way... Thanks! billo -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup
-- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup
