delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/06/09/14:13:59

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=3.7 required=5.0 tests=AWL,BAYES_05,BOTNET,RCVD_IN_DNSWL_NONE
X-Spam-Check-By: sourceware.org
MIME-version: 1.0
Message-id: <4C0FD9C0.4070006@cygwin.com>
Date: Wed, 09 Jun 2010 14:13:20 -0400
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-to: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090320 Remi/2.0.0.21-1.fc8.remi Lightning/0.9 Thunderbird/2.0.0.21 Mnenhy/0.7.5.0
To: cygwin AT cygwin DOT com
Subject: Re: crontab not working-need some advice
References: <28833847 DOT post AT talk DOT nabble DOT com>
In-reply-to: <28833847.post@talk.nabble.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

On 6/9/2010 1:59 PM, curiousgeorge wrote:
>
> Hi,
> I installed cygwin on windows server 2003 and am trying to learn about cron.
> I created a simple script as follows:
> #!/usr/bin/bash
> #move the file every 1 min
> echo 'date'>>  datelog.txt
> mv datelog.txt outbound
>
> I then created a crontab using the command crontab -e as follows:
>
> # DO NOT EDIT THIS FILE - edit the master and reinstall.
> # (/tmp/crontab.3k4GtqrIIX installed on Sat Jun  5 14:51:33 2010) # (Cron
> version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
> */1 * * * * /home/administrator/scripts/mvscript
>
> but nothing is happening. I was able to successfully run the script
> manually. But when trying to accomplish it through cron, nothing happens. I
> checked the services in start -->administrative tools-->services and I see
> cron Daemon running. I dont see anything in logs either.

 From the crontab(5) man page:

        Step values can be used in conjunction with ranges.  Following a  range
        with  ``/<number>''  specifies  skips of the number's value through the
        range.  For example, ``0-23/2'' can be used in the hours field to spec‐
        ify command execution every other hour (the alternative in the V7 stan‐
        dard is ``0,2,4,6,8,10,12,14,16,18,20,22'').  Steps are also  permitted
        after  an asterisk, so if you want to say ``every two hours'', just use
        ``*/2''.

I don't think */1 in the minute field is really what you want.

Keep in mind that running a script from the command line is *very* different
than running it through 'cron'.  'cron' has none of your user's environment
for one thing.   So you should make sure that all file references have full
paths, for example.

None of this is Cygwin-specific.  Since this list is dedicated to the
discussion of Cygwin issues, discussions outside that area are discouraged.
If you're not sure how 'cron' should work, I recommend checking out man pages
and other documentation available on-line for help over that hurdle.  If in
the process you find something that's a Cygwin issue, that's something to
bring back up with this list.

-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

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

- Raw text -


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