For a while, I've had this script, chipd, which will update ZoneEdit whenever my IP changes. However, I have to remember to run it myself occasionally since it isn't setup to run on a schedule. Since it is a bash script, I decided to try to get Cygwin cron to run it instead of having it run as a Windows Scheduled Task. It took some fiddling, but I got it working.

  • I installed cron using the Cygwin setup.exe.
  • I ran crontab -e under my luser account to create schedule table. I wanted the sript to run every 15 minutes and initially tried using */15 in the minutes field, but that didn't seem to work so I ended up using a list - 0,15,30,45. All other fields were *.
  • I originally called a wrapper script in the cronab, but that didn't work for some reason (that I think is related to the way redirection was done in the wrapper script), so I updated the cronab to directly call chipd like this:
    
            /usr/local/bin/chipd 2>&1 >> /var/log/chipd.log
    
            
  • I also had to separate the fields in the crontab with tabs instead of spaces.
  • Since I was running the cron service under my luser account I had to:
    • chown luser /var/log/cron.log
    • rm /vor/run/cron.pid - so it would be recreated with the correct owner
  • Install cron as a Windows service:
    
            cygrunsrv -I cron -u luser -d "CYGWIN cron" -e "CYGWIN=tty ntsec" -p /usr/sbin/cron -a -D
    
            
  • Start the cron service:
    
            cygrunsrv --start cron