www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/21/18:32:01

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW
X-Spam-Check-By: sourceware.org
Mime-Version: 1.0 (Apple Message framework v1077)
Subject: Re: Cron on Windows 7 as a Service Does Not Execute Jobs
From: Szatmary Janos <janos AT szatmary DOT name>
In-Reply-To: <0A68F03B-FFCD-4A8D-9580-B70FBD216D02@yahoo.com>
Date: Sat, 21 Nov 2009 18:30:46 -0500
Message-Id: <431A9184-EB41-4979-B222-1230B5010399@szatmary.name>
References: <9E6BBE7F-3D5F-4DC5-B701-367AC5DF9C14 AT yahoo DOT com> <0KTF005VJVXCFSS9 AT vms173013 DOT mailsrvcs DOT net> <0A68F03B-FFCD-4A8D-9580-B70FBD216D02 AT yahoo DOT com>
To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Pierre,

sshd, exim and cron all work correctly under Cygwin 1.7.0 and Windows 7 32-=
bit.
CYGWIN_NT-6.1 host 1.7.0(0.218/5/3) 2009-11-19 10:07 i686 Cygwin

Regards,

John

On Nov 20, 2009, at 10:53 PM, Janos Szatmary wrote:

> This is CYGWIN_NT-6.1 host 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
> Since this was a test for a stable environment I didn't want to use a bet=
a release.
>=20
> Yes, "user" is the user name, which I created specifically for testing (y=
ou may notice some output shows "janos" which is my actual account I starte=
d with)
> There was a successful setuid to the non-privileged user account in the s=
trace.
>=20
> I have also...
> 	Uninstalled and reinstalled cron through cygrunsrv several times.
> 	Reset all the permissions on cyg_server user with editrights from the cr=
on-config script
>=20=09
> I'm not sure if 1.5 support will continue and wether W7/32 compatibility =
is important for the release, so I'll try 1.7 and see if it has the same is=
sues.
> Thanks for the quick response. If you want me to debug 1.5 further, or wo=
uld like the full strace output let me know. Otherwise, I'll post 1.7 resul=
ts just as an FYI.
>=20
> Regards,
>=20
> John
>=20
> On Nov 20, 2009, at 10:20 PM, Pierre A. Humblet wrote:
>=20
>> At 06:43 PM 11/20/2009, randomerror wrote:
>>> All,
>>>=20
>>> I can't seem to get cron to execute jobs under Windows 7 (Ultimate.) He=
re are the things I've done...
>>>=20
>>> ----------------------------------------
>>> Installed cygwin for all users, and fixed some permission problems.
>>> Configured sshd and it works fine.
>>> Configured exim (without running it as a service) and it works fine (de=
livers mail through a smart host).
>>>=20
>>> ----------------------------------------
>>> Configured cron through cron-config running under cyg_server (that was =
created by sshd,) and it runs but does not execute jobs.
>>> Cronevents shows that the job commands are running, but in reality they=
 are not:
>>>=20
>>> 2009/11/20 17:49:02 [cyg_server] /usr/sbin/cron: PID 4080: (user) CMD (=
echo test)
>>> 2009/11/20 17:50:01 [cyg_server] /usr/sbin/cron: PID 4028: (user) CMD (=
echo test)
>>> 2009/11/20 17:53:01 [cyg_server] /usr/sbin/cron: PID 3384: (user) CMD (=
sleep 30)
>>> 2009/11/20 17:54:01 [cyg_server] /usr/sbin/cron: PID 1404: (user) CMD (=
sleep 30)
>>> 2009/11/20 18:24:01 [cyg_server] /usr/sbin/cron: PID 3928: (user) CMD (=
echo test > /tmp/abcd)
>>> 2009/11/20 18:25:01 [cyg_server] /usr/sbin/cron: PID 2004: (user) CMD (=
echo test > /tmp/abcd)
>>>=20
>>> The sleep job was to test whether I can see the job run with ps; I coul=
d not.
>>>=20
>>> ----------------------------------------
>>> So I ran cron from the command line (starting MinTTY as an Administrato=
r) as follows:
>>>=20
>>> /usr/sbin/cron -n -x ext,sch,proc,pars,load,misc,bit
>>>=20
>>> This worked: jobs were being executed and output was e-mailed via exim.
>>>=20
>>> ----------------------------------------
>>> Next, I tried to run cron as SYSTEM but that of course failed, with cro=
n starting and immediately stopping.
>>> Lastly, I used strace to attach to the running cron service, which work=
s up until the point that the job execution would begin:
>>>=20
>>> $ ps -ef
>>>    UID     PID    PPID TTY     STIME COMMAND
>>> cyg_serv    3752       1   ?  13:53:57 /usr/bin/cygrunsrv
>>> cyg_serv    2172    3752   ?  13:53:57 /usr/sbin/sshd
>>> cyg_serv    1020       1   ?  17:47:17 /usr/bin/cygrunsrv
>>> cyg_serv    1144    1020   ?  17:47:17 /usr/sbin/cron
>>>  janos    3240       1   ?  18:28:21 /usr/bin/mintty
>>>  janos    1168    3240   0  18:28:22 /usr/bin/bash
>>>  janos    2192    1168   0  18:29:58 /usr/bin/ps
>>>=20
>>> user AT host ~
>>> $ strace -f -p 1144
>>> **********************************************
>>> Program name: C:\cygwin\usr\sbin\cron.exe (pid 1144, ppid 1020)
>>> App version:  1005.24, api: 0.156
>>> DLL version:  1005.25, api: 0.156
>>> DLL build:    2008-06-12 19:34
>>> OS version:   Windows NT-6.1
>>> Heap size:    402653184
>>> Date/Time:    2009-11-20 18:35:19
>>> **********************************************
>>> .
>>> .
>>> .
>>> 183 42989963 [main] cron 3012 build_env: envp 0x61169EB0, envc 28
>>>  46 42990009 [main] cron 3012 child_info::child_info: subproc_ready 0x1=
98
>>> 8151 42998160 [main] cron 3012 spawn_guts: 3012 =3D spawn_guts (/bin/sh=
, C:\cygwin\bin\sh.exe -c "/bin/echo test")
>>>  98 42998258 [main] cron 3012! spawn_guts: new process name C:\cygwin\b=
in\sh.exe
>>> 135 42998393 [main] cron 3012! _pinfo::dup_proc_pipe: duped wr_proc_pip=
e 0x4 for pid 3012(2056)
>>> Windows process 4080 attached
>>> Windows process 3004 attached
>>> Windows process 3012 attached
>>> strace: couldn't attach to subprocess 2056 for debugging, windows error=
 5
>>>=20
>>> This crashes cron, so it needs to be restarted.
>>>=20
>>> ----------------------------------------
>>> Does anybody have any pointers on what else to check or how else to dia=
gnose why the jobs are not running?
>>>=20
>>> Regards,
>>>=20
>>> John
>>=20
>> You have done everything right, AFAICS, and a pretty good debugging job.
>> I see "user" in the log, is that an actual user name ?
>>=20
>> Except for that, as far as cron is concerned, everything looks OK.
>> Presumably you have seen a successful setuid in the strace.
>> Cron prints the log line and execs sh, without checking if it succeeds, =
but there
>> is nothing it can do about that. It's a cygwin issue.
>> Presumably you are using 1.7
>> Unfortunately I don't have Windows 7 to reproduce the problem.
>>=20
>> Not sure what to suggest. Perhaps running "strace  cron" as a service
>> would give you more info. That will fill /var/log/cron.log pretty fast :)
>>=20
>>=20
>> Pierre (cron maintainer)
>>=20
>>=20
>>=20
>>=20
>>=20
>>=20
>> --
>> Problem reports:       http://cygwin.com/problems.html
>> FAQ:                   http://cygwin.com/faq/
>> Documentation:         http://cygwin.com/docs.html
>> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
>=20


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

- Raw text -


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