X-Spam-Check-By: sourceware.org Date: Thu, 5 Jan 2006 19:14:42 -0500 (EST) From: Igor Peshansky Reply-To: cygwin AT cygwin DOT com To: lin q cc: cygwin AT cygwin DOT com Subject: Re: Help : can not get cron work In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-342241519-1136506482=:5388" Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk 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 ---559023410-342241519-1136506482=:5388 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT I guess including this in the body wasn't prominent enough... AGAIN: . Please read the meaning of this acronym before continuing this thread. Thanks. On Thu, 5 Jan 2006, lin q wrote: > > From: Igor Peshansky > > Reply-To: cygwin AT XXXXXX DOT XXX > > To: lin q > > CC: cygwin AT XXXXXX DOT XXX The above is what refers to. > > Subject: Re: Help : can not get cron work > > Date: Thu, 5 Jan 2006 17:32:17 -0500 (EST) > > > > On Thu, 5 Jan 2006, lin q wrote: > > > > > > Subject: Re: Help : can not get cron work > > > > Date: Thu, 5 Jan 2006 14:23:06 -0500 (EST) > > > > > > > > On Thu, 5 Jan 2006, lin q wrote: > > > > > > > > > > From: Brian Dessent > > > > > > Reply-To: cygwin AT XXXXXX DOT XXX > > > > > > To: cygwin AT XXXXXX DOT XXX > > > > > > > > . Thanks. > > > > > > > > > > Subject: Re: Help : can not get cron work > > > > > > Date: Wed, 04 Jan 2006 18:00:46 -0800 > > > > > > > > > > > > lin q wrote: > > > > > > > > > > > > > 1) "cygrunsrv -I cron -p /usr/sbin/cron -a –D" > > > > > > > > > > > > You should run /usr/bin/cron-config, and not try to do this by > > > > > > hand because there is much more to do than just installing the > > > > > > service. > > > > > > > > > > > > > 16 10 * * * linq rsync -azv emperor:/dev/tools/* /cygdrive/c/bin/tools > > > > > > > > > > > > That is not the proper format of a user's crontab line. > > > > > > There is no such "username" field as the fifth field in a > > > > > > user's crontab, it should just be "16 10 * * * rsync ...". > > > > > > It was trying to execute a command named "linq" that does not > > > > > > exist, and there should be errors to this effect in the > > > > > > Windows Event Log. See "man 5 crontab". > > > > > > > > Yep, I missed that... > > > > > > > > > > Also realize that if you do not have system-wise mounts and > > > > > > Cygwin in the PATH the above will not work. This would have > > > > > > been evident if you attached the cygcheck output as requested > > > > > > in . > > > > > > > > > > OK, I re-installed cron using /usr/bin/cron-config and I > > > > > corrected crontab by removing that "linq". > > > > > > > > > > It still does not work. > > > > > > > > > > I tried a Hello Wold test with the following crontab line, > > > > > > > > > > * * * * * /bin/date > /tmp/date.out 2>&1 > > > > > > > > > > It works fine. > > > > > > > > Good. > > > > > > > > > Now I come to suspect something of Cygwin setup. But I can not > > > > > see anything wrong in log file of cygcheck. I attach the file. > > > > > > > > > > One thing to note, when I run cygcheck, it exits with an error, > > > > > > cygcheck -svr > /tmp/cygcheck.log > > > > > cygcheck: dump_sysinfo: GetVolumeInformation() failed: 1231 > > > > > > > > > > Is this a problem? > > > > > > > > Nope. Error 1231 means "The network location cannot be reached.". > > > > Must be a network drive. > > > > > > > > > Another thing, I checked the Windows event loger and I see some > > > > > "Information" on crontab, here is the dump out: > > > > > > > > > > The description for Event ID ( 0 ) in Source ( /usr/sbin/cron ) > > > > > cannot be found. The local computer may not have the necessary > > > > > registry information or message DLL files to display messages > > > > > from a remote computer. You may be able to use the /AUXSOURCE= > > > > > flag to retrieve this description; see Help and Support for > > > > > details. The following information is part of the event: > > > > > > > > This is just junk that the Event Viewer adds when it doesn't know > > > > how to parse the event data. You can safely ignore it. > > > > > > > > > /usr/sbin/cron : PID 6064 : (linq) CMD (rsync -azv > > > > > emperor:/dev/swtools/* /cygdrive/c/bin/swtools). > > > > > > > > And this is just cron informing you exactly which job it was > > > > trying to run. > > > > > > > > > Do you understand what it is about? > > > > > > > > Looking at the cron job, there could be a few possibilities for > > > > failure: cron doesn't find rsync; the wildcard gets expanded too > > > > early; rsync has output that cron doesn't know where to send > > > > because you don't have an smtp daemon running... At least your > > > > mounts look ok. Try eliminating the possibilities above by fixing > > > > your cron job... > > > > > > Thanks. > > > > > > I did some correction, now here is my crontab: > > > > > > > crontab -l > > > # DO NOT EDIT THIS FILE - edit the master and reinstall. > > > # (/tmp/crontab.4232 installed on Thu Jan 5 15:02:10 2006) > > > # (Cron version -- $Id: crontab.c,v 1.8 2004/12/21 16:14:41 corinna Exp $) > > > * * * * * /usr/bin/rsync -azv emperor:/devl/swtools c:/bin/swtools > > > > > > Again I tested that the command, "/usr/bin/rsync -azv > > > emperor:/devl/swtools c:/bin/swtools" works fine if I type it on shell. > > > > Does it work from a SYSTEM-owned shell (search the archives for > > "sysbash")? > > > > > I still can not make it work. > > > > > > The last suggestion you give is about smtp daemon, I do not quite > > > understand. Could you elabrate on that? > > > > Whenever a cron job writes anything to stdout/stderr, cron tries to > > email the output to the user whose crontab it's running. If you don't > > have an smtp daemon running, the cron job will fail (IIRC). Try > > redirecting the output to a file in a known location. You can also > > try starting an smtp daemon (there are a couple in Cygwin, AFAIR), but > > redirection is so much easier. > > Thanks, I tried that and this time I know what is going wrong. > > The problem is rsync. Here is the logging of the error, > > Could not create directory '/cygdrive/h/.ssh'. > Host key verification failed. > rsync: read error: Connection reset by peer (104) > rsync error: error in rsync protocol data stream (code 12) at > /home/lapo/packaging/tmp/rsync-2.6.6/io.c(584) > > This is really confusing. I can run the command manually, no problem. > But in cron it does not work. From its error message, I see 2 problem, > not sure if they are dependent, Something is different when your rsync is running under cron -- perhaps the value of $HOME? > 1) can not create directory /cygdrive/h/.ssh. > That directory already exists and it holds the ssh files like > authorized_keys2, id_dsa, id_dsa.pub and known_hosts, why when running > in cron, rsync tries to create it? Isn't 'H' a network drive? That is probably your problem -- read . > 2) Host key verification failed. > But verification has no problem when I run in shell. Again, the service has no access to the file to do the host key verification against. See the above link. > I wonder if I should set up some variable in crontab file? > > I add "echo $LOGNAME > /tmp/file" and I can see that it is correct. I think your problem is that you're trying to access a password-protected share from a service-impersonated user. The above FAQ link has some recipes for working around this. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!) |,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte." "But no -- you are no fool; you call yourself a fool, there's proof enough in that!" -- Rostand, "Cyrano de Bergerac" ---559023410-342241519-1136506482=:5388 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ---559023410-342241519-1136506482=:5388--