Instalar cron daemon en Windows con Cygwin es muy fácil como veremos a continuación.
Hay que bajar e instalar el paquete cron desde setup.exe, luego de eso procedemos a instalar cron como servicio.
$ /usr/bin/cron-config Do you want to install the cron daemon as a service? (yes/no) yes The service can run either as yourself or under a privileged account. Running as yourself allows better access to network drives, but does not allow to run the crontab of other users. Do you want to the cron daemon to run as yourself? (yes/no) no Do you want the daemon to run with ntsec? (yes/no) no Do you want to start the cron daemon as a service now? (yes/no) yes OK. The cron daemon is now running.
Ahora para agregar un cron primero hay que setear un editor distinto de vi con el siguiente comando y luego usar crontab.
export EDITOR=nano crontab -e
Para ejecutar una tarea cada 5 minutos por ejemplo podemos poner algo como esto:
0-59/5 * * * * curl http://localhost/nic.cl/nic.php
Para listar los crones usaremos contab -l
$ crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.804 installed on Fri Dec 8 20:43:18 2006) # (Cron version -- $Id: crontab.c,v 1.8 2004/12/21 16:14:41 corinna Exp $) 0 0-23/4 * * * /usr/bin/updatedb 0-59/5 * * * * curl http://localhost/nic.cl/nic.php
Para detener o iniciar el servicio se puede cygrunsrv o bien al estilo Windows net stop/start cron.