delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/04/20/10:57:27

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 105C7385828B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1713625045;
bh=MbHDBdttYCxy/wD/RfvSl+rVFV3UElq0kHtTvnJnb/c=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=uR8sRenW/6ewvCfmXQufMBM+KZV6wGqoyC1BCNy+ZcNqnMMPCgA+r6UjRcNPQZ9VM
bsb3K7YZvRbExABzul27aSZ1nusE4TtTWDqpJTuuHzoTUlq2lV3+7718x15kfesOXX
FASTH8k76jSX27oKObWwZ4ZTqPjJMUaXdykOfdc4=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3C03F3858D37
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3C03F3858D37
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713624997; cv=none;
b=bQzmwdceWANzq8Q5fe8Vny6pGK2R7CcURTN0SLgcfWV7jncp3WxV5+rH1vTq8P5Ylr8M5v5hgXgRLV0/IPkoQpRRqFVHXUVe7fCPyVJ0boeFa2zKl78TGMPvEUQ5nKASlc6Czmsv5Hch+EZLfCkyN7ynDy5zVESbRNO+To/vmjA=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1713624997; c=relaxed/simple;
bh=h2wLACYoaZlb2RMGAgguoetVOs1av/4KUEUDAm5k+js=;
h=Message-ID:Date:MIME-Version:Subject:To:From;
b=JpKyPQpdE2ePY+9mZ3+6gPrzWjhUqLMMpyoU4QVFtOMf814uY/CCADsPxEketHxwzCxnrdGoQ/lFn6ziXpppsEcBFY1Z26TGD15mN5Pc8ci/7EwvzYv+W7WqtgxtvF9VTOLSaOGLxPAAAQ3M8/hKz+ZSzEtj9FrKjeE2QaTczM8=
ARC-Authentication-Results: i=1; server2.sourceware.org
Message-ID: <d725d594-09cb-4540-96a1-ee60470998a0@SystematicSW.ab.ca>
Date: Sat, 20 Apr 2024 08:56:28 -0600
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: cygrunsrv: trailing command line arguments not allowed
To: cygwin AT cygwin DOT com
References: <402bcd5955c3f4ec870e565ab14688dd AT perezterron DOT net>
<b3bf6422-0259-28d7-26a4-f0149c1371e9 AT cs DOT umass DOT edu>
Organization: Systematic Software
In-Reply-To: <b3bf6422-0259-28d7-26a4-f0149c1371e9@cs.umass.edu>
X-Rspamd-Queue-Id: 4ABD260009
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,
SPF_PASS, TXREP,
UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6
X-Stat-Signature: qhuzj1spkofrg9ke1qn7gd8tnc8o64kn
X-Rspamd-Server: rspamout05
X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361
X-Session-ID: U2FsdGVkX189Suw2Hxc2Z2u/cZwoPiDwVAVfT/Xk0Vs=
X-HE-Tag: 1713624989-814041
X-HE-Meta: U2FsdGVkX19Ov4zCBVhJp6fGnNz8cr2OAZOi03I6D3+ttMAOmA6U3DnqJtu5vRJYjGSHf19QdmIqFgDyfw5OV99KYRMEIN8lp/VjWC6TXMuRUakAewaceJ8UjwK8igrAVpftBt/TMw8Czzz5Ib7b/ZpxAFki1Mj2wTppkP5pGTLfRZHYBGfgWIuUldo87Stzu12xaBismjLzS6rqUV6IG+jf4APcs4i6hGF8Aa/lE1/LtxBpfBPTkcpu5naM7Yv/6e5l4C0WdSYmJqSq9UOavizWXR8VeKLcRJCN7xggiZwTty+8TEpWvoi8UF+642IGbYdQ2SeLYyguhcXc6Pz5euZ2RJE5Gcz/
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Brian Inglis via Cygwin <cygwin AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
Cc: Brian Inglis <Brian DOT Inglis AT SystematicSW DOT ab DOT ca>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 43KEvQwZ076224

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

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019