(I realize this list is technically only for patches on cygwin, but cygrunsrv is
close enough...)
I've implemented some new features for cygrunsrv that I think might be useful to
people. Examples follow.
A new command -L / --list can be specified that will list all installed
cygrunsrv services:
$ cygrunsrv --list
apache cron cygserver mailtun sshd
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.
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
$ 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
Service : apache
Description : Cygwin: Apache httpd server
Current State : Stopped
Command : /usr/sbin/httpd -F
stdin path : /dev/null
stdout path : /var/log/apache.log
stderr path : /var/log/apache.log
Process Type: Own Process
Startup : Manual
Account : LocalSystem
Service : cron
Display name: cron daemon
Description : Cygwin: Provides scheduled execution of commands
Current State : Running
Controls Accepted : Stop
Command : /usr/sbin/cron -D
stdin path : /dev/null
stdout path : /var/log/cron.log
stderr path : /var/log/cron.log
Process Type: Own Process
Startup : Automatic
Account : LocalSystem
Service : cygserver
Description : Cygwin: helper service for security, semaphores, ipc, etc
Current State : Running
Controls Accepted : Stop
Command : /usr/sbin/cygserver
stdin path : /dev/null
stdout path : /var/log/cygserver.log
stderr path : /var/log/cygserver.log
Process Type: Own Process
Startup : Automatic
Account : LocalSystem
Service : mailtun
Description : Cygwin: SSH tunnel for dessent.net POP3 and SMTP services
Current State : Running
Controls Accepted : Stop, Shutdown
Command : /bin/autossh.exe -M 29038 -N -L 25:localhost:25 -L
110:localhost:110 -l tunnel dessent.net
stdin path : /dev/null
stdout path : /var/log/mailtun.log
stderr path : /var/log/mailtun.log
Special flags : --shutdown
Process Type: Own Process
Startup : Automatic
Dependencies: Tcpip, cygserver, named
Account : .\brian
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
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 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.
I apologise if the patch is a little large,