delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/01/14/00:52:29

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
From: "David Christensen" <dpchrist AT holgerdanske DOT com>
To: "'The Cygwin Mailing List'" <cygwin AT cygwin DOT com>
References: <7ine1pai DOT fsf AT cante DOT net> <C440775DE111CD47B341A35CF512425D03FD4984 AT auntm231 DOT apac DOT corp DOT eds DOT com>
Subject: RE: Running perl script in cron in cygwin under Windows
Date: Sun, 13 Jan 2008 21:51:34 -0800
Message-ID: <043901c85671$859ea900$0a00a8c0@a64x23800p>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <C440775DE111CD47B341A35CF512425D03FD4984@auntm231.apac.corp.eds.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

Macalalad, Jun wrote:
> I've been trying  to run a perl script from cron in cygwin -- not
> good.  It runs when in a cygwin command prompt. Any idea where I've
> done wrong please? Help?

Do you have cron working?  Verify it with a simple command, such as 'touch'.


If that works, try a Perl one-liner such as the following:

    20080113-214329 dpchrist AT a64x23800p ~
    $ perl -e 'open FH, "> /home/dpchrist/hello.out"; print FH "hello,
world!\n"'


If all of the above works, I'd suspect the environment variables/ path --
cron doesn't set up the same environment as you get with an interactive
login shell.  My standard trick is to write a Bash shell script that sets up
the environment (typically by invoking .bash_profile and/or .bashrc) and
then launches the Perl script, and then have cron run the wrapper script.


HTH,

David


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

- Raw text -


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