This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help : can not get cron work





Subject: Re: Help : can not get cron work
Date: Thu, 5 Jan 2006 19:14:42 -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:
> > > >
> > > >
> > > > > > 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 <http://cygwin.com/problems.html>.
> > > > >
> > > > > 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
<http://cygwin.com/faq/faq.using.html#faq.using.shares>.
Thanks, I think you are right, after check out this page, I think it is the problem.

But I wonder how we can do it.

There are 3 suggestions over there,
1) using public network share that does not require authentication (for non-critical files)
2) providing your password to a net use command
3) running the service as your own user with cygrunsrv -u


But 1) does not apply here in my environemnt.

2), I do not quite understand it. And I think I can not use it either. I tried "net use H: *" trying to set up the password, but it errors out on syntax.

3), In the very beginning I used cygrunsrv command to start cron, but there is some problem. And earlier in this thread I was suggested to use cron-config. Actually below are the screenshot of my running cron-config, you can see that it specifically asked me whether to setup the service as my own,



$ /usr/bin/cron-config
Cron is already installed as a service under account XLNX\jibinh.
Do you want to remove or reinstall it? (yes/no) yes
OK. The cron service was removed.

Do you want to install the cron daemon as a service? (yes/no) yes
The service can run either as yourself or under a privileged account.
Running as yourself allows better access to network drives,
but does not allow to run the crontab of other users.
Do you want to the cron daemon to run as yourself? (yes/no) yes

Do you want the daemon to run with ntsec? (yes/no) yes

Please enter the password for user 'linq': ******
Reenter: ******

WARNING: /usr/sbin/sendmail should point to an executable mailer
    such as ssmtp or exim.

Do you want to start the cron daemon as a service now? (yes/no) yes
OK. The cron daemon is now running.

In case of problem, examine the log file for cron,
/var/log/cron.log, and the Windows event log
for information about the problem cron is having.

If you cannot fix the problem, then report it to cygwin@cygwin.com.
Please include a copy of your crontab, ('crontab -l')
and the output of 'cygcheck -srv > cygcheck.txt'.

Please include the generated file 'cygcheck.txt' *as an attachment*,
and NOT in the body of the mail message.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]