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 Date: Thu, 19 May 2005 20:08:34 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: Brian Dessent cc: cygwin AT cygwin DOT com Subject: Re: [patch] several new features for cygrunsrv In-Reply-To: <428CE837.C00E288B@dessent.net> Message-ID: References: <428CE837 DOT C00E288B AT dessent DOT net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-ID: On Thu, 19 May 2005, Brian Dessent wrote: > (I realize this list is technically only for patches on cygwin, but > cygrunsrv is close enough...) Replying to the main Cygwin list. > I've implemented some new features for cygrunsrv that I think might be > useful to people. Examples follow. First off, Brian, thank you, thank you, thank you! Both of these had been on my TODO list for a (sigh) very long time, and I'm glad you've gotten a round tuit before me. A couple of comments on the patch, though. > A new command "-L" / "--list" can be specified that will list all > installed cygrunsrv services: > > $ cygrunsrv --list > apache cron cygserver mailtun sshd Since some services have spaces in their names, it might perhaps be a better idea to output one service name per line (I would even go so far as add a -0/--null option to end lines with '\0', but that's for a later patch). If one wanted them on one line, something like echo `cygrunsrv -L` will do. > This is meant to facilitate scripting, e.g. if you wanted to disable all > running Cygwin services you can now do something like: > > for S in `cygrunsrv -L`; do cygrunsrv -E $S; done > > If a service name contains spaces it will be double-quoted. Ugh. That would necessitate the use of "eval" (or parsing the string, if this were done programmatically)... > The other major change is a new flag "-V" / "--verbose" which adds a lot > more output to both the --list and the --query commands. The output of > --query is also made more sensible, for example the "Own Process" > attribute is pretty much a given so I moved it into the --verbose mode. > > I had in mind a goal to add complete dumping of all information about > services to cygcheck to aid in troubleshooting, and this makes it so > that cygcheck can simply system("cygrunsrv --list --verbose"). Some > examples: > > $ cygrunsrv -Q sshd > Service : sshd > Display name : ssh daemon > Description : Cygwin: Accepts remote ssh sessions > Current State : Stopped > Command : /usr/sbin/sshd -D Ah, you've added the command line parameters here. Very cool. > $ cygrunsrv -Q sshd --verbose > Service : sshd > Display name : ssh daemon > Description : Cygwin: Accepts remote ssh sessions > Current State : Stopped > Command : /usr/sbin/sshd -D > stdin path : /dev/null > stdout path : /var/log/sshd.log > stderr path : /var/log/sshd.log > Environment : CYGWIN="ntsec" > Process Type : Own Process > Startup : Manual > Account : LocalSystem > > Most every aspect of the service will be listed in verbose mode. Below > you can see that with both new options you get a wealth of information: > > $ cygrunsrv --list --verbose > [long service list snipped] > > As you can see, if we simply add this to cygcheck we can now diagnose > problems with services much quicker since nearly every bit of > information is displayed. It might be a good idea to get a short list of services unless cygcheck got a "-v" option (basically pass the --verbose setting to cygrunsrv). It's not that simple, though, since "cygrunsrv -L" won't output enough information without "-v", but you get the idea... > It also makes it easier if you want to modify some aspect of a service > that is currently installed, because --verbose mode essentially gives > you a blueprint of all the options that were used installing the > service. In fact that was one of the additional things I had planned on > doing but didn't make it into this patch: A command that says "tell me > what command I would use to install service X." That way if you wanted > to modify any aspect of the service the pain of uninstalling and > reinstalling is gone, especially if you no longer remember the options > you used when creating the service. This is pretty cool. Again, thanks for doing this. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "The Sun will pass between the Earth and the Moon tonight for a total Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT -- 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/