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