Cygwin Cron

June 21, 2010 at 09:37:49
Specs: windows server 2003 R2 Standard Edition Service Pack 2
I want to know how to debug a cron tab that is not executing. I also want to know if someone can help me get this crontab to run. It calls a php script once daily that updates Drupal modules and does Drupal housekeeping.

Using cron in cygwin.

Command is: 30 5 * * * /usr/bin/wget -O - -q -t 1

Editor: vim

When I run command /usr/bin/wget -O - -d -t 1 in command line, it works. It works means: Drupal aggregator module updates feeds, as do other module tasks handled by cron.php

When I run from browser, it works.

When I save command in a crontab, nothing happens.

I am a new user of cron and cygwin although I have spent eleven days on this to date and am learning. I have googled, posted at Drupal forum, talked to server IT fellow, read Drupal instructions, and posted to cygwin mail list.

I am working on a department server at a university. It's connected to our web network. I have the following rights on this server: power user (possess most admin powers with restrictions. can run legacy app in addition to certified apps) remote desktop user (can login remotely) and users (prevented from making addicental or intentional system-wide change.

Cygwin is installed at C:/cygwin It's a new install.

I located one command to use as a test and I ran it in a crontab:

$ crontab -l

# (/tmp/crontab.kEkN9TLCym installed on Mon Jun 21 07:
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/
10,20,30,40,50,0 * * * * date > /tmp/test-trace.txt

This created a test-trace.txt file in C:\cygwin\tmp that has 0 bytes.

When I ran my command in the CLI with -d switch, I got the following:

$ /usr/bin/wget -O- -t1 -d
DEBUG output created by Wget 1.11.4 on cygwin.

--2010-06-17 14:48:54--
Caching =>
Connecting to||:80... connected.
Created socket 3.
Releasing 0x00ac94a8 (new refcount 1).

---request begin---
GET /cron.php HTTP/1.0
User-Agent: Wget/1.11.4
Accept: */*
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 200 OK
Date: Thu, 17 Jun 2010 21:48:54 GMT
Server: Apache/2.2.15 (Win32)
Set-Cookie: SESS9ba5500cc8672b58ffb5d574c3076d59=00471ce6d5ca56c55525a1d197b5eab
3; expires=Sun, 11-Jul-2010 01:22:14 GMT; path=/;
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Thu, 17 Jun 2010 21:48:54 GMT
Cache-Control: store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8

---response end---
200 OK
Registered socket 3 for persistent reuse.
cdm: 1 2
Stored cookie -1 (ANY) / <permanent> <insecure> [expiry 2010-07
-10 18:22:14] SESS9ba5500cc8672b58ffb5d574c3076d59 00471ce6d5ca56c55525a1d197b5e
Length: 0 [text/html]
Saving to: `STDOUT'

[ <=> ] 0 --.-K/s in 0s

2010-06-17 14:49:04 (0.00 B/s) - `-' saved [0/0]

Thank you in advance for any help. Greatly appreciated.

See More: Cygwin Cron

Report •

June 22, 2010 at 01:19:25
Is the cron service running??

According to this :

You need to run: "cron-config" to setup the daemon - have you done that & verified it's listed as 'Started' in services??

I've tried to use the Cygwin port of cron before too & had some problems with it. Had better luck w/ CRONw - .

Also - you know you can do all of this w/ Scheduled tasks & batch files right?? That's actually what Drupal recommends for windows boxen, see

Hope that helps.

Report •

June 22, 2010 at 06:23:59
Thank you! I am so glad I came here. I have been struggling with this for too long. I will follow your advice this morning and report back; I suspect you may be right. I cannot use Task Scheduler on this Windows 2003 Server because the IT folks do not allow browsers on the server. The security wall is extremely high at universities.

Report •

June 22, 2010 at 15:59:44
I certainly feel foolish. I am usually overly thorough so I am embarrassed that I did not realize that cron had to be installed. And I had looked for readme's but did not discover them until going through this exercise. Good grief.

Thank you for the help!

I have come across the following, which concerns me. I do not have the knowledge to fully understand this. I am asking our IT fellow to do the cygwin cron install on our Windows 2003 server because of what I read here. Nevertheless, what little I am able to understand from this causes me to pause. What does this mean to the IT Admin I am having do the install?

Like the person who wrote the post below, we have one person Administrator and the rest have various privileges. Catastrophic??

"I'm on Windows Server 2003 and carefully read through
/usr/share/doc/Cygwin/cron-4.1-57.README prior to configuring cron. The guide discusses how a privileged user account is required in order to run cron. The script /usr/bin/cron-config gives you the option of creating a user account on behalf (e.g. cyg_server) or using your own account, i.e.

"Since Windows2003, the SYSTEM account cannot setuid to other users. You may need to have or to create a privileged account."

*** Throughout the setup process, there is no suggestion that using your own Administrative account, or the BUILTIN "Administrator" account is discouraged ****

However, the script /usr/bin/cron-config will set NT Rights
"SeDenyInteractiveLogonRight, SeDenyNetworkLogonRight,
SeDenyRemoteInteractiveLogonRight". In the case of a newly created account is this fine, but if it is a user supplied account then the account is instantly locked out.

In the case of a Win2K3 box with only one administrative account, i.e.
"Administrator" (and everyone else running using under priv accounts
in a terminal services environment) this turns out to be catastrophic.

Can the script please be modified to at least WARN the user that these
rights will be applied. It seems to me that "your own" account can't
really be used at all, for if the rights "SeDenyInteractiveLogonRight,
SeDenyNetworkLogonRight, SeDenyRemoteInteractiveLogonRight" are all
applied then the account cannot be used interactively.

Report •
Related Solutions

Ask Question