Cygwin and crontab - How to get crontab started running when using Cygwin

Cygwin crontab FAQ: How do I get the crontab system started when using Cygwin?

I can't remember where I found it, but using this series of commands from the Cygwin prompt got the Cygwin crontab system enabled for me. First this command:

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

followed by:

net start cron

I haven't used this cygwin feature before, so it feels weird knowing that crontab is running on my Windows system under cygwin.

An example Cygwin crontab entry

I don't have much in my Cygwin crontab yet, just one entry that runs a wget command to a certain URL every night. Here's the actual crontab entry, which actually calls a Bourne shell script that I wrote for this purpose:

45 18 * * * /cygdrive/c/Al/Reports/ 2> /dev/null

As you may or may not guess, this crontab entry runs this script every day of every month of every year at 6:45 p.m. ("18" referring to the hour, "45" to the minutes) local time. The shell script itself writes output to a file (which I'll describe elsewhere on this blog), but if there happens to be any error output I'm just redirecting it to /dev/null (the proverbial bit bucket) because I'm really not interested in it.



Thanks a lot for your great summary of setting up crontab in Cygwinland.

It would be much improved if it also mentioned this file that comes with Cygwin, because it has lots of more in-depth hints:


In my case, I had to find that file to find that my failing job was writing to $HOME/cron.log since I don't have a mail server like sendmail set up.


After executing the command above ...
cygrunsrv -I cron -p /usr/sbin/cron -a -D

I get the following error in C:\cygwin\var\log\cron.log ...
cron: unknown option -- D
usage: /usr/sbin/cron [-n] [-x [ext,sch,proc,pars,load,misc,test,bit]]

To fix,
a. remove existing service via bash shell (and viewed from Windows Services applet)
cygrunsrv --remove cron

b. reinstall correct cron service using new commands below ...
cygrunsrv -I cron -p /usr/sbin/cron -a "-x sch,proc,pars,load,misc"

c. reboot and check that the cron windows services has started and the cron.log looks like this ...
[1988] cron started
log_it: (CRON 1988) STARTUP (V5.0)

Sorry, I haven't had a chance to use Windows in a while now, but hopefully the "Updated cron service" comment from Andrew is helpful here.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.