delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/01/20:32: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
Sensitivity:
Subject: Re: cron and copying files across drives: how?
To: cygwin AT cygwin DOT com
Message-ID: <OF2487347F.77657205-ON88256F20.0082448E@mailconnect.com>
From: Eric_Zeller AT ffic DOT com
Date: Fri, 1 Oct 2004 17:32:09 -0700
MIME-Version: 1.0

I have not signed up to receive emails from this list, but I read it from
the archives, so I would appreciate being cc'd on any responses to this
thread.


I am also trying to use cron to grab log files everyday from a webserver
here at work (names have been changed to increase the difficulty of trying
to break in.

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

I put 'cygcheck -s' in a script and ran it from the command line and from a
cron entry and ran the 2 outputs through a diff program.
There were some non-critical differences in $PATH (mostly referencing
non-existent directories),
MAKE_MODE, PWD, and USER were not defined in the cron environment,
but everything else was the same, even the output of the id program

Output from C:\cygwin\bin\id.exe (nontsec)
UID: 1003(myuserid) GID: 513(None)
513(None)

Output from C:\cygwin\bin\id.exe (ntsec)
UID: 1003(myuserid) GID: 513(None)
0(root)                   513(None)
544(Administrators)       545(Users)


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

I had already put a 'net use' statement in there (to make sure the drive is
mounted before I access it)
This works from the command line but fails in the cron environment

net use /USER:myuserid \\\\\\\\mywebserver\\\\logs mypasswd

note: 'net use' (to return status) does succeed in the cron env.

So I have several questions:
How do I tell when I'm in a SYSTEM shell (other than the lack of the USER
env variable.
How can I mount a drive when I'm in a SYSTEM shell (do I lack permissions?
Is it sandboxed in some way?)
Failing this method, how can I run cygwin perl scripts from a DOS shell? (I
can try and use the windows task scheduler, but currently I get an error
that the cygwin1.dll is not loaded, I suppose I could just install perl for
windows directly, but that seems redundant)





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