X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=1.3 required=5.0 tests=AWL,BAYES_00,FORGED_YAHOO_RCVD,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Subject: Re: Cron on Windows 7 as a Service Does Not Execute Jobs Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=us-ascii From: Janos Szatmary In-Reply-To: <0KTF005VJVXCFSS9@vms173013.mailsrvcs.net> Date: Fri, 20 Nov 2009 22:53:04 -0500 Cc: cygwin AT cygwin DOT com Content-Transfer-Encoding: quoted-printable Message-Id: <0A68F03B-FFCD-4A8D-9580-B70FBD216D02@yahoo.com> References: <9E6BBE7F-3D5F-4DC5-B701-367AC5DF9C14 AT yahoo DOT com> <0KTF005VJVXCFSS9 AT vms173013 DOT mailsrvcs DOT net> To: "Pierre A. Humblet" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 beta = release. Yes, "user" is the user name, which I created specifically for testing (you= may notice some output shows "janos" which is my actual account I started = with) There was a successful setuid to the non-privileged user account in the str= ace. I have also... Uninstalled and reinstalled cron through cygrunsrv several times. Reset all the permissions on cyg_server user with editrights from the cron= -config script =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 issu= es. Thanks for the quick response. If you want me to debug 1.5 further, or woul= d like the full strace output let me know. Otherwise, I'll post 1.7 results= just as an FYI. Regards, John On Nov 20, 2009, at 10:20 PM, Pierre A. Humblet wrote: > 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.) Her= e 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 (del= ivers mail through a smart host). >>=20 >> ---------------------------------------- >> Configured cron through cron-config running under cyg_server (that was c= reated 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 (e= cho test) >> 2009/11/20 17:50:01 [cyg_server] /usr/sbin/cron: PID 4028: (user) CMD (e= cho test) >> 2009/11/20 17:53:01 [cyg_server] /usr/sbin/cron: PID 3384: (user) CMD (s= leep 30) >> 2009/11/20 17:54:01 [cyg_server] /usr/sbin/cron: PID 1404: (user) CMD (s= leep 30) >> 2009/11/20 18:24:01 [cyg_server] /usr/sbin/cron: PID 3928: (user) CMD (e= cho test > /tmp/abcd) >> 2009/11/20 18:25:01 [cyg_server] /usr/sbin/cron: PID 2004: (user) CMD (e= cho test > /tmp/abcd) >>=20 >> The sleep job was to test whether I can see the job run with ps; I could= not. >>=20 >> ---------------------------------------- >> So I ran cron from the command line (starting MinTTY as an Administrator= ) 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 cron= starting and immediately stopping. >> Lastly, I used strace to attach to the running cron service, which works= 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 diag= nose 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, b= ut 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 >=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 -- 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