User Tools

Site Tools


cygwin_cron_under_windows

CYGWIN Cron under Windows

Windows task scheduler is pretty dumb – console apps make a console window appear if you're logged in, and you can't specify full command lines with pipes and redirects. Therefore, I install CYGWIN cron to fill the gap. Here's how.

First, install the "cron" package from Cygwin.

Then, run a cygwin shell and do:

$ chmod +r /etc/passwd /etc/group
$ chmod +x /var
$ cron-config

Questions:

  • Install the cron daemon as a service? yes
  • Value of CYGWIN for the daemon: ntsec smbntsec (This will be the default if you followed my SSH setup directions)
  • Run the cron daemon as yourself? no
  • Start the cron daemon as a service now? yes

To set up cron jobs, create a crontab file (probably in your home directory cygwin/home/<username>):

#.---------------- minute (0 - 59) 
#|  .------------- hour (0 - 23)
#|  |  .---------- day of month (1 - 31)
#|  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ... 
#|  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7)  OR sun,mon,tue,wed,thu,fri,sat 
#m  h  D  M  DoW   COMMAND
0   *  *  *  *     ~/example/do-something-every-hour

Then add it to cron with:

$ crontab cron
cygwin_cron_under_windows.txt · Last modified: 2009/06/15 14:16 by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki