Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <422642FF.166358A9@dessent.net> Date: Wed, 02 Mar 2005 14:49:35 -0800 From: Brian Dessent Organization: My own little world... MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Keeping cygwin updated on remote systems References: <31b7d279050302120875fa9734 AT mail DOT gmail DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com "DePriest, Jason R." wrote: > How can I handle in-use files if I am not using setup.exe? > > I would love to hear any suggestions that anyone has. You'll have to cobble something together and use a non-Cygwin method to do the file replacement. For example, if you're using rsync over ssh then you will be unable to replace ssh.exe, rsync.exe, cygwin1.dll, and probably a handful of other DLLs -- check "cygcheck /bin/ssh" and "cygcheck /bin/rsync". One way might be to write in use files as "whatever.exe.new" and add the list of replacements to a text file. You might be able to do this by piping the output of your rsync command into a script that looks for write errors and copies those over the files with ".new" appended. Then write a windows command script (.cmd) that stops all cygwin services and processes, reads that list and uses windows move to replace them, and then restarts whatever needs to be restarted. Schedule this .cmd file to run every N minutes from Windows' task scheduler and have it check for the replacements text file. Or you could use the "at" command through ssh to schedule this .cmd task to happen in N minutes if you detect that inuse files needed to be replaced. You could also use the method that setup.exe uses which is Windows' own "in file use replacement", but this requires a reboot which you may not want to mess with. If you do want to try this you can look for the inuse.exe tool which comes with the Resource Kit. I think that this amounts to writing the src/dest list of filenames in \0-delimited format to HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations. But you have to use Native paths here because win32 subsystem has not yet started. So c:\foo\bar becomes \??\c:\foo\bar. I think you prepend this with '!' to indicate that the file is to be deleted first, I'm not sure. Finally, you could also try using a win32-native sshd and scp or rsync client. You could have this installed listening on a nonstandard port, as a service that you start before an upgrade and then stop when finished, so as not to have extra stuff running normally. But, you would have to make sure that permissions and ownership are handled correctly, because native windows tools may not understand them. If so you could also use a native program like cacls or xcacls over native-ssh to make sure that the ACLs are set correctly. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/