delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/10/20/13:25:30

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 20 Oct 2008 13:24:11 -0400
From: "Pierre A. Humblet" <Pierre DOT Humblet AT ieee DOT org>
Subject: Re: Problems with cron
To: =?iso-8859-1?Q?J=F6rg_Schreiber?= <Joerg DOT Schreiber AT Springer DOT com>,
<cygwin AT cygwin DOT com>
Message-id: <005d01c932d8$b12386b0$940410ac@wirelessworld.airvananet.com>
MIME-version: 1.0
X-Mailer: Microsoft Outlook Express 6.00.2900.3138
References: <18684 DOT 42055 DOT 166971 DOT 681309 AT viper DOT pip DOT springer DOT de>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

----- Original Message ----- 
From: "Jörg Schreiber"
To: cygwin AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019