views:

3613

answers:

2

Some cygwin commands are .exe, so you can run them with the standard Windows Scheduler, but others are not .exe extension so cant be run from dos (it seems like). For example I want updatedb to run nightly.

Any ideas on how to make cron work?

+6  A: 

You need to also install cygrunsrv so you can set cron up as a windows service, then run cron-config.

If you want the cron jobs to send email of any output you'll also need to install either exim or ssmtp (before running cron-config.)

See /usr/share/doc/Cygwin/cron-*.README for more details.

Regarding programs without a .exe extension, they are probably shell scripts of some type. If you look at the first line of the file you could see what program you need to use to run them (e.g., "#!/bin/sh"), so you could perhaps them from the windows scheduler by calling the shell program (e.g., "C:\cygwin\bin\sh.exe -l /my/cygwin/path/to/prog".)

Evan
+1  A: 

You have two options:

  1. Install cron as a windows service, using cygrunsrv:

    cygrunsrv -I cron -p /usr/sbin/cron -a -D

    net start cron

  2. The 'non .exe' files are probably bash scripts, so you can run them via the windows scheduler by invoking bash to run the script, e.g.:

    C:\cygwin\bin\bash.exe -l -c "C:\full-path\to\script.sh"

By the way, this isn't a programming question (http://stackoverflow.com/faq).

edoloughlin