How do I get crontab started running when using cygwin?

I can't remember where I found it, but using this series of commands from the cygwin prompt got the 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.

I don't have much in the 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/do_nightly_wget.sh 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.

Add README reference

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:

/usr/share/doc/Cygwin/cron-4.1-6.README

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.

Thanks for the input. I don't ...

Thanks for the input. I don't have access to a Windows/Cygwin system right now, but hopefully your note will help other people trying to get this working.

Awsome it worked :)

Awsome it worked :)

Post new comment

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