Problem with Cron and Permissions...

Jim Kogler jkogler@mak.com
Wed Nov 26 04:13:00 GMT 2008


I recently upgraded cygwin (current version info at end of email) from a 
fairly old version ( at least 3 years old...) and have run into this 
problem:

I have a cron job, that runs a scrip on a SAMBA mount. The script writes 
to the SAMBA mount, here is a bit of the script:

------ Script Cut Start -----
echo "one"
   echo `date` > $lockFile
echo "two"
   echo `date` > $lockFile
echo "three"
   echo `id`
------ Script Cut End -----

where $lockFile is in the same directory as the script.

The output when run from a Cron Job is
---------------------------- START -------------------------------
+ echo one
one
date
++ date
+ echo Tue Nov 25 16:31:02 EST 2008
/engineering/nightly/scripts/runPendingFastBuilds.sh: line 101: 
/engineering/nightly/locks/fastBuildSweep.lock.nwin32-vc8-2: Permission 
denied
+ echo two
two
date
++ date
+ echo Tue Nov 25 16:31:02 EST 2008
+ echo three
three
id
++ id
+ echo 'uid=30147(nightbus)' 'gid=100(mkgroup)' 
'groups=0(root),544(Administrators),545(Users),10545(mkgroup-l-d),100(mkgroup)'
uid=30147(nightbus) gid=100(mkgroup) 
groups=0(root),544(Administrators),545(Users),10545(mkgroup-l-d),100(mkgroup)
---------------------- End ---------------------------------

Please note the permissions problem for the first attempt to write to 
this file. Thats the problem.

It appears the first attempt to write to a file using "echo "foo" > " 
will generate this error and create an empty (size 0) file. The second 
write will succeed.

This ONLY happens when the script is run from a crontab.

Further, other commands WILL operate on the file the first time: touch 
appears to work. So if my script were

touch $logfile
echo `date` > $logfile

there would be no problem. Obviously its a very big script, so I am only 
sending the problem part. Needless to say a whole lot of our build 
system is failing because of this. It seems the mount is correct, since 
the script itself is in the same directory we are trying to write to. I 
can read files in there, just can't write to them on the first attempt.

Is there more information I can provide? Is this a know issue? Am I 
doing something wrong?

Here is my system information:

bash-3.2$ echo $BASH_VERSION
3.2.39(20)-release

The output from cygcheck -s -v -r is attached in a text file.

Jim


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: systemInfo.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20081126/75c43f60/attachment.txt>
-------------- next part --------------
--
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