This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems with cron


----- Original Message ----- 
From: "Jörg Schreiber"
To: cygwin@cygwin.com
Sent: Monday, October 20, 2008 11:31 AM
Subject: Problems with cron



Hi,

I've installed cygwin and I'm very pleased with it. Now I want to use
cron to run some kind of backup script where I need the possibilities
of a real shell (not DOS). After installing cron and ssmtp I first got
e-mails from cron. It seems to run, but since I've started cron as a
service (2008/10/17) it didn't work anymore and I don't know what
"can't cd to HOME" means. The HOME environment variable is set and
nothing was changed between 16th and 17th.

*********
That's weird. The cron daemon is running as yourself, so access to network drives
should not be a problem (HOME = /cygdrive/h, I presume).
One explanation is that h: is not accessible to you when running as a service.
This can be confirmed  by the following test, which does not involve cron at all.

1) Create a shell script:
~: cat > c:/testit
env
pwd
cd /cygdrive/h                                 <==  use whatever is proper
pwd
<ctrl-D>
2) Create and run a "test" service under yourself
~: cygrunsrv -I test -u p-humblet -p /bin/sh -a c:/testit                   <== use your name
Enter password of user:
Reenter, please:
~: cygrunsrv -S test
cygrunsrv: Error starting a service: QueryServiceStatus:  Win32 error 1062:
The service has not been started.                                                  <== don't 
worry about this
3) Look at the output
~: cat /var/log/test.log

Alternatively run the following service, which tries to ls your HOME,
cygrunsrv -I ls -u p-humblet -p /bin/ls -a $HOME
Start it and look at /var/log/ls.log

Note that it may make a difference if you specify your HOME as a drive (/cygdrive/h)
or as a network path //computer/share.
I have just tested at my work, where my Windows home is U: I cannot use it from a service.
However I can use the expanded path (which is listed in /etc/passwd, and used as default by 
cron)
You may want to try changing that before running the tests above.

If the explanation holds, you have a choice between talking to your administrator or creating
a HOME on a local disk. From there you may be able to access your real HOME with "net use ..."

I have also noticed that your group is listed as mkpasswd-l-d. Thus the group and passwd file
my not have been properly installed. Perhaps if they were, you would not need to specify HOME.

Pierre 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]