public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* cygrunsrv: trailing command line arguyments not allowed
@ 2024-04-20 12:12 enrique
  2024-04-20 12:31 ` Eliot Moss
  2024-04-20 16:05 ` cygrunsrv: trailing command line arguyments " enrique
  0 siblings, 2 replies; 4+ messages in thread
From: enrique @ 2024-04-20 12:12 UTC (permalink / raw)
  To: cygwin

Hello,

I am trying to install a service manually in an attempt to understand 
why cron-config did not work for me.

So, I did this:

> $ net stop cron
> Tjenesten Cron daemon stopper .
> Tjenesten Cron daemon ble stoppet.
> 
> $ cygrunsrv -R cron
> 
> $ cygrunsrv -I -p /usr/sbin/cron.exe -a -n
> cygrunsrv: Trailing commandline arguments not allowed
> Try `cygrunsrv --help' for more information.

I also tried a number of other combinations and orders of arguments, all 
with similar results.

What am I doing wrong?

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cygrunsrv: trailing command line arguyments not allowed
  2024-04-20 12:12 cygrunsrv: trailing command line arguyments not allowed enrique
@ 2024-04-20 12:31 ` Eliot Moss
  2024-04-20 14:56   ` cygrunsrv: trailing command line arguments " Brian Inglis
  2024-04-20 16:05 ` cygrunsrv: trailing command line arguyments " enrique
  1 sibling, 1 reply; 4+ messages in thread
From: Eliot Moss @ 2024-04-20 12:31 UTC (permalink / raw)
  To: enrique, cygwin

On 4/20/2024 8:12 AM, enrique--- via Cygwin wrote:
> Hello,
> 
> I am trying to install a service manually in an attempt to understand why cron-config did not work for me.
> 
> So, I did this:
> 
>> $ net stop cron
>> Tjenesten Cron daemon stopper .
>> Tjenesten Cron daemon ble stoppet.
>>
>> $ cygrunsrv -R cron
>>
>> $ cygrunsrv -I -p /usr/sbin/cron.exe -a -n
>> cygrunsrv: Trailing commandline arguments not allowed
>> Try `cygrunsrv --help' for more information.
> 
> I also tried a number of other combinations and orders of arguments, all with similar results.
> 
> What am I doing wrong?
> 
> Thanks

I would try --args '-n' instead of -a -n.  Perhaps some other
variation of quoting will be needed to make clear to cygrunsrv
that the -n is for the application, not for cygrunsrv.

Best - Eliot Moss


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cygrunsrv: trailing command line arguments not allowed
  2024-04-20 12:31 ` Eliot Moss
@ 2024-04-20 14:56   ` Brian Inglis
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Inglis @ 2024-04-20 14:56 UTC (permalink / raw)
  To: cygwin

On 2024-04-20 06:31, Eliot Moss via Cygwin wrote:
> On 4/20/2024 8:12 AM, enrique--- via Cygwin wrote:
>> Hello,
>>
>> I am trying to install a service manually in an attempt to understand why 
>> cron-config did not work for me.
>>
>> So, I did this:
>>
>>> $ net stop cron
>>> Tjenesten Cron daemon stopper .
>>> Tjenesten Cron daemon ble stoppet.
>>>
>>> $ cygrunsrv -R cron
>>>
>>> $ cygrunsrv -I -p /usr/sbin/cron.exe -a -n
>>> cygrunsrv: Trailing commandline arguments not allowed
>>> Try `cygrunsrv --help' for more information.
>>
>> I also tried a number of other combinations and orders of arguments, all with 
>> similar results.
>>
>> What am I doing wrong?

> I would try --args '-n' instead of -a -n.  Perhaps some other
> variation of quoting will be needed to make clear to cygrunsrv
> that the -n is for the application, not for cygrunsrv.

Unadorned options anywhere on the command line are parsed by getopt, which is 
why the options are quoted by cron-config:

$ awk '/cygrunsrv\s-I/,/[^\\]$/' /usr/bin/cron-config
                 if cygrunsrv -I cron -p /usr/sbin/cron -e CYGWIN="${cygenv}" -e 
TMP="/tmp" \
                     -e TEMP="/tmp" -a "-n" -d "Cron daemon" -u "$cyg_username" 
-w "$password"
                 if cygrunsrv -I cron -p /usr/sbin/cron -e CYGWIN="${cygenv}" \
                     -a "-n" -d "Cron daemon"

I have normally found it more useful to run Cygwin *-config as elevated admin, 
and if from cmd with Cygwin /bin/ in path, then as `bash -c /usr/bin/*-config`.

You can modify settings either with:

	$ cygrunsrv -E $srv; cygrunsrv -R $srv; cygrunsrv -I $srv ...

possibly adding:

	-d, --disp "CYGWIN Cron daemon"
	-c, --chdir `cygpath -m /`
	-O, --preshutdown
	-y, --dep syslog-ng ...

or with:

$ sc config help
DESCRIPTION:
         Modifies a service entry in the registry and Service Database.
USAGE:
         sc <server> config [service name] <option1> <option2>...

OPTIONS:
NOTE: The option name includes the equal sign.
       A space is required between the equal sign and the value.
       To remove the dependency, use a single / as dependency value.
  type= <own|share|interact|kernel|filesys|rec|adapt|userown|usershare>
  start= <boot|system|auto|demand|disabled|delayed-auto>
  error= <normal|severe|critical|ignore>
  binPath= <BinaryPathName to the .exe file>
  group= <LoadOrderGroup>
  tag= <yes|no>
  depend= <Dependencies(separated by / (forward slash))>
  obj= <AccountName|ObjectName>
  DisplayName= <display name>
  password= <password>

for example:

$ sc cron config start= delayed-auto DisplayName= "CYGWIN Cron daemon" \
	depend= syslog-ng

or

$ s=/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/cron; \
   regtool set -d $s/KEY DWORD-VALUE; \
   ...

giving something like:

$ s=/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/cron; \
   for p in {'',/Parameters{,/Environment}}; do \
	echo; echo $s$p:; regtool list -v $s$p;
   done

/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/cron:
Parameters/ ()
DisplayName (REG_SZ) = "CYGWIN Cron daemon"
Type (REG_DWORD) = 0x00000010 (16)
Start (REG_DWORD) = 0x00000002 (2)
ErrorControl (REG_DWORD) = 0x00000001 (1)
ImagePath (REG_EXPAND_SZ) = ".../bin/cygrunsrv.exe"
ObjectName (REG_SZ) = "LocalSystem"
Description (REG_SZ) = "Cygwin Command Execution Scheduler cron daemon"
DelayedAutoStart (REG_DWORD) = 0x00000001 (1)
DependOnService (REG_MULTI_SZ) = "syslog-ng"

/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/cron/Parameters:
Environment/ ()
AppPath (REG_SZ) = "/usr/sbin/cron"
AppArgs (REG_SZ) = "-n"
Preshutdown (REG_DWORD) = 0x00000001 (1)

/proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/cron/Parameters/Environment:
CYGWIN (REG_SZ) = " "

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cygrunsrv: trailing command line arguyments not allowed
  2024-04-20 12:12 cygrunsrv: trailing command line arguyments not allowed enrique
  2024-04-20 12:31 ` Eliot Moss
@ 2024-04-20 16:05 ` enrique
  1 sibling, 0 replies; 4+ messages in thread
From: enrique @ 2024-04-20 16:05 UTC (permalink / raw)
  To: Cygwin

Den 2024-04-20 14:12, skrev enrique--- via Cygwin:
>> $ cygrunsrv -I -p /usr/sbin/cron.exe -a -n
>> cygrunsrv: Trailing commandline arguments not allowed
>> Try `cygrunsrv --help' for more information.
[snip]
> What am I doing wrong?

I found it: Missing service name after "-I".

-Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-20 16:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-20 12:12 cygrunsrv: trailing command line arguyments not allowed enrique
2024-04-20 12:31 ` Eliot Moss
2024-04-20 14:56   ` cygrunsrv: trailing command line arguments " Brian Inglis
2024-04-20 16:05 ` cygrunsrv: trailing command line arguyments " enrique

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).