Re: Cron not working

2015-03-10 Thread Larry Hall (Cygwin)

On 03/10/2015 09:48 AM, Stefan Schumacher wrote:


Hello

I am trying to set up a cron job to run a script every 10 minutes. I
have installed cron via the installer and configured it with cron-config
  to run as a system service.
Mar 10 14:11:33 stefan-PC cron: PID 3408: `cron' service started

This is stefan's crontab, generated with crontab -e.
*/10 * * * * /cygdrive/c/Users/stefan/copy_from_fileserver

According to /var/log/messages the cron job is executed correctly, but
no test file is generated in the directory. Calling copy_from_fileserver
  from the command line works without complications and copies the
file from the server as it should.

Mar 10 14:40:01 stefan-PC /usr/sbin/cron: PID 2340: (stefan) CMD 
(/cygdrive/c/Users/stefan/copy_from_fileserver)

How can I get this working?


First, we need to know what your script is doing and what your configuration
is, both for cron and for Cygwin.  Check out the problem reporting
guidelines at the link below for details.


Problem reports:   http://cygwin.com/problems.html


Just a wild guess based on what you said so far, your script requires
resources (paths, environment variables, permissions, etc.) that aren't
available to the script when it runs.  Keep in mind that the script isn't
being run by your user and as a result, you can't assume that your user's
environment exists when it runs.  If your script assumes these things, it
will fail.  To solve this problem, you need to identify the needed resources
and make sure they are available when the script runs.  This may be as
simple as running the crond service under your user's account (this means
that the service can _only_ service your user's account though) or adding
some needed environment to your script.


--
Larry

_

A: Yes.
 Q: Are you sure?
 A: Because it reverses the logical flow of conversation.
 Q: Why is top posting annoying in email?

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



Re: cron not working

2010-03-29 Thread Rajashekar Chintalapati
Thanks for letting me know the problem.
It worked after giving some time.

Rajashekar.

On Sun, Mar 28, 2010 at 5:44 PM, Pierre A. Humblet
pierre.humb...@ieee.org wrote:
 At 06:22 PM 3/28/2010, Rajashekar Chintalapati wrote:

 Hi,
  I am trying to run a simple script using crontab.

 $ more /cygdrive/c/list
 ls -ltr /cygdrive/c/  /tmp/li.txt

 $ crontab -l
 # DO NOT EDIT THIS FILE - edit the master and reinstall.
 # (/tmp/crontab.ry22Lho7uW installed on Sun Mar 28 14:03:55 2010)
 # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie
 Exp $)
 4 14 * * * /cygdrive/c/list



 snip


 Please find attachment - cronbug.txt
 It once run correctly, i am able to see in logs too.
 2010/03/28 01:00:01 [SYSTEM] /usr/sbin/cron: PID 4060: (Administrator)
 RELOAD (tabs/Administrator)
 2010/03/28 01:01:01 [SYSTEM] /usr/sbin/cron: PID 4068: (Administrator)
 CMD (/cygdrive/c/list  /tmp/error.log 21)


 But after that not sure what went wrong, if i change the time, cron is
 not executing the /cygdrive/c/list.

 Can you please let us know what may be the problem.

 The problem is that you set the time in the crontab just right so that you
 hope
 cron will execute it at the next minute.
 # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp
 $)
 4 14 * * * /cygdrive/c/list

 Unfortunately for you, cron procrastinates. At the next minute cron reloads
 the
 crontab, but it only executes the commands at the following minute.

 2010/03/28 01:00:01 [SYSTEM] /usr/sbin/cron: PID 4060: (Administrator)
 RELOAD (tabs/Administrator)
 2010/03/28 01:01:01 [SYSTEM] /usr/sbin/cron: PID 4068: (Administrator) CMD
 (/cygdrive/c/list  /tmp/error.log 21)

 2010/03/28 14:04:01 [SYSTEM] /usr/sbin/cron: PID 4060: (Administrator)
 RELOAD (tabs/Administrator)
 2010/03/28 14:04:31 [Administrator] crontab: PID 1040: (Administrator) LIST
 (Administrator)

 The first time you gave cron the extra minute it needed. The second time you
 didn't.

 Pierre




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



Re: cron not working

2010-03-28 Thread jurriaan
From: Rajashekar Chintalapati rajash...@gmail.com
Date: Sun, Mar 28, 2010 at 02:22:57PM -0800
 Hi,
 ? I am trying to run a simple script using crontab.
 
 $ more /cygdrive/c/list
 ls -ltr /cygdrive/c/  /tmp/li.txt
 
 2010/03/28 01:01:01 [SYSTEM] /usr/sbin/cron: PID 4068: (Administrator)
 CMD (/cygdrive/c/list  /tmp/error.log 21)
 
 
 But after that not sure what went wrong, if i change the time, cron is
 not executing the /cygdrive/c/list.
 
Since you'r running Cygwin, I'd presume you want unix scripts.
In that case, a 

#!/bin/sh

is missing at the top.

If you want a dos script, I'd suggest using DOS filenames, using \ as
separator.

Does that solve your problem?

Kind regards,
Jurriaan
-- 
I learn more sometimes from questions I know the answers to.
Guy Gavriel Kay - A Song for Arbonne

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