www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/16/17:40:52

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Date: Thu, 16 Sep 2004 17:40:43 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Andrea M <andrea DOT m AT bufera DOT org>
cc: cygwin AT cygwin DOT com
Subject: Re: cron and copying files across drives: how?
In-Reply-To: <414A0635.20407@bufera.org>
Message-ID: <Pine.GSO.4.61.0409161736140.27864@slinky.cs.nyu.edu>
References: <414A0635 DOT 20407 AT bufera DOT org>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.39

On Thu, 16 Sep 2004, Andrea M wrote:

> I am having a problem running a simple bash script with cron. The script
> executes and behaves as expected when run from the command line, but
> when run by cron, it fails to execute some commands.

Cron runs as a different Windows user ("SYSTEM"), so things that work from
your normal logon may not work from there.

> I narrowed the problem down and found out that cron fails to copy files
> between drives; for example, the following does not work
>
> * * * * * cp /cygdrive/c/Andrea/try.png /cygdrive/z/try.png
>
> I should mention that the z drive is a network drive.

Well, here's your problem.

> And yes, a simple script containing that command does execute correctly
> from the prompt.
>
> Thanks in advance

Simple: the z drive isn't accesible to SYSTEM.  Either make it accessible
(by doing a "net use" before/when starting the service), or don't use
/cygdrive/z in your scripts.  FWIW, if the share is publicly accessible
you can use the following syntax instead:

* * * * * cp /cygdrive/c/Andrea/try.png //remote.machine/share/try.png

You may still need to do a "net use", though.  Try testing it out in a
system-owned shell (Google for the recipe).
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Happiness lies in being privileged to work hard for long hours in doing
whatever you think is worth doing."  -- Dr. Jubal Harshaw

--
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