Running perl script in cron in cygwin under Windows

David Christensen dpchrist@holgerdanske.com
Mon Jan 14 10:09:00 GMT 2008


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



More information about the Cygwin mailing list