crontab not working-need some advice

Larry Hall (Cygwin) reply-to-list-only-lh@cygwin.com
Wed Jun 9 18:13:00 GMT 2010


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



More information about the Cygwin mailing list