X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org From: Haojun Bao To: cygwin AT cygwin DOT com Subject: Re: Many Cygwin (mintty) windows - How to close all? References: <2bf229d30910081120q384b329fs7e24b560bf721947 AT mail DOT gmail DOT com> <4ACFE190 DOT 7000700 AT biyani DOT org> Date: Sat, 10 Oct 2009 16:14:27 +0800 In-Reply-To: <4ACFE190.7000700@biyani.org> (Arun Biyani's message of "Fri, 09 Oct 2009 20:21:20 -0500") Message-ID: <83ocof1x98.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (cygwin) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 Arun Biyani writes: > Chris Sutcliffe wrote: >>>> Is there some sort of Cygwin command that - >>>> 1. Closes all Mintty windows >>>> 2. Unloads services - such as cron >>>> 3. Exits X server >>>> >>>> in short, gets rid of all Cygwin processes so I can update & restart >>>> without having to do all this myself. >>>> >>> I use the attached script (run it elevated on Vista and above) before >>> updating with setup. This is only tested on Vista. >> >> Doing a 'kill -9 -1' works for me in terms of getting rid of all my >> mintty windows at once. I'm not sure if it will kill services and >> exit the X server as well. >> >> Chris >> > Thanks for the suggestions. > Arun Or you may want to check out http://windows-config.googlecode.com The following 2 files can do the job you thus wanted: http://windows-config.googlecode.com/svn/trunk/bin/windows/terminateModule.py together with http://windows-config.googlecode.com/svn/trunk/gcode/modules/modules/Program.cs The C# .net programming provides a `System.Diagnostics' package, which you can use to enum every process and every PE32 executable (dll or exe) loaded by each process, then you just grep "cygwin1.dll" and TerminateProcess each of them. Put it in a python script... You can terminate all notepad.exe with `terminateModule.py notepad.exe' for example. Another thing, when running `terminateModule.py', the python must be the native win32 python, with pywin32 installed, not the one shipped with cygwin. The reason should be apparent. Then there comes another problem, you must run it like "c:/python25/python q:/bin/windows/terminateModule.py notepad.exe" which is too boring So, I just wrote a bash helper that will make it possible to invoke native python from the shebang like: #!/bin/env pywinstart.exe the pywinstart.exe is a *general* .exe file, which will only invoke bash with a `helper.sh' and the command line arguments, in helper.sh, it will see pywinstart.exe is executing, so instead it will invoke a *pywinstart.sh*, which then *cygstart* the native python, with the .py file path "~/bin/windows/terminateModule.py" transformed to it's win32 path using `cygpath -alm' If you are interested, consider checkout the whole http://windows-config.googlecode.com/svn/trunk and execute its bin/windows/after-check-out.sh and bin/windows/startup.sh, and reboot. See what happens... Be fore-warned: it will change your keyboard's CapsLock into Control, among other not very polite things:-) > > -- > Problem reports: http://cygwin.com/problems.html > FAQ: http://cygwin.com/faq/ > Documentation: http://cygwin.com/docs.html > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple