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