cron script can awk wget file but not head/cat it

Pagano, Tom - Portland, OR tom.pagano@por.usda.gov
Fri Sep 9 23:34:00 GMT 2005


Thank you for the very prompt response.

If I assume that it's the System that's running the script via the cron,
isn't System the owner of the file that results from wget? Or do wgetted
files belong to someone else? And do Awk and Cat require different
permission levels (presumably awk is more lax than cat because even
though they were doing the same thing, cat couldn't see the file
contents whereas awk could). Besides, from my ls in my previous mail, it
appears to me that user-group-other all have read permissions to all the
files so it shouldn't even matter?

Do you have any recommendations on how I can change my script or some
setting to fix the problem? I could change all my cat and head
statements to awk statements, but that seems more like treating the
symptom rather than the disease. 

Thanks

Tom


-----Original Message-----
From: Eric Blake [mailto:ericblake@comcast.net] 
Sent: Friday, September 09, 2005 2:23 PM
To: Pagano, Tom - Portland, OR; cygwin@cygwin.com
Subject: Re: cron script can awk wget file but not head/cat it


>  
> And sntl_data_moved_then_headed.csv contains: Cannot open file 
> /home/tompagano/test/sntl_data_moved.csv
> This is a simplification of a much broader script I've been trying to
run that 
> was failing, but I've been able to isolate it down to this specific
problem. I'm 
> quite baffled as to why moving then awking a file would give a
different result 
> than catting or heading. It doesn't appear to be a permissions issue
as far as I 
> can tell because I can still move the files around? Am I missing
something here? 

Yes - remember that cron scripts run as the SYSTEM user, so they have
different access permissions than the command line.  When you use cp,
and a new file is created, the new file is owned by the current user;
but
when you use mv, the renamed file maintains the same owner.  Based on
who owns what, your cron script can't read files depending on how those
files were obtained and moved/copied.

--
Eric Blake




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



More information about the Cygwin mailing list