Error using cygrunsrv to stop bash scripts

Igor Pechtchanski
Tue Mar 2 16:30:00 GMT 2004


Please make sure your mailer respects the Reply-To: header -- I set it for
a reason.  More below.

On Tue, 2 Mar 2004, Cousins, Andrew wrote:

> Igor,
> Service is installed with
> #
> cygrunsrv   --install actest3                      	 	\
>                 --path c:/usr/Cyg-Win32/bin/bash.exe   	\
>                 --args d:/usr/ea/dr_service/ 		\
>                 --desc "MOSAIC/DNMS Disaster Recovery"  	\
>                 --type manual                          		\
>                 --neverexits                            		\
>                 --shutdown
> The log files put out a single line .. Terminated.... each time the service
> is stopped

There should be *one* log file, /var/log/actest3.log.  Which ones are you
looking at?  Try explicitly specifying it using the "-1" and "-2"
cygrunsrv options.  Also, what does the Windows Event log show
(on Win2k, right-click on "My Computer", choose "Manage", then "Event

> Putting a cygcheck -svr in the service script and redirecting output to a
> file I get this with the last line (code 5)  repeated a few times before the
> Terminated Message.
> cygcheck: dump_sysinfo: GetVolumeInformation() failed: 67
> cygcheck: dump_sysinfo: GetVolumeInformation() failed: 67
> cygcheck: dump_sysinfo: GetVolumeInformation() failed: 5
> ....
> ....
> Terminated

$ net helpmsg 67
The network name cannot be found.
$ net helpmsg 5
Access is denied.

I'd suspect something wrong with your mounts (e.g., they aren't system
mounts), or directory permissions.  The output of "cygcheck -svr" from a
regular shell would have been very helpful (and it *is* requested in the
Cygwin problem reporting guidelines at <>,
which you should read in any case).

> Putting
> 	env >> tempfile
> doesn't produce anything from within the service.

Which probably means that the service runs with an empty environment...
Unless...  Try specifying /bin/env explicitly, just in case, as well as
the full path to the tempfile.  Putting 'echo "$PATH" >&2' into the bash
script might also be helpful.

> Looks like it's only stderr being generated from within the service as there
> is none of the additional info I get from these two commands when it is run
> interactively.
> Tried the INT signal, same symptons. Does what I want, but displays the
> error messages.

Did you try trapping SIGINT in the bash script and printing out a message
before exiting?

> I'm not Windows enabled - how would I run this interactively under a SYSTEM
> owned sh.
> Thanks
> Andrew C.

Googling for "system-owned window cygwin" should give you a couple of
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list