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: cron and copying files across drives: how?


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/


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