Re: PHP and cron jobs



Thanks David, I deleted all the files and changed teh ribbon creation
routine to chmod the file when it was created as 666, this looks like it has
worked!

As this is a shared host running the cron as root or sudo (new to me but
from what I can tell changes me as a used to root with passwrod) are two
options not open.

Mat
"David Haynes" <david.haynes2@xxxxxxxxxxxx> wrote in message
news:IWCRf.41774$cm3.33127@xxxxxxxxxxxxxxxxxxxxxxxx
Matthew Augier wrote:
Hey all

I help out at a gaming website, where we play BF2 and track player
stats/give them awards etc. I've got a whole backend and everything works
exactly as I need... except for when I need to update the awards via cron
job. Then I'm getting a "imagepng(): Unable to open 'xxx.png' for writing
in XXX". All the paths are correct as it loads other images as part of
the process, and I belive it's a permission issue. The files are in a 777
folder and each file has the permission of 644 (User 65534, grou 65534) -
what am I doing wrong?

(BTW tried different permissions, and if I delete the file the cron job
creates it, but then you can't access it via a http request)

Many thanks


As I understand it:

cron runs as the effective user id of the name of the crontab file.
e.g. if you have a crontab file named 'foo', then crontab will run as the
effective user 'foo'.

I say 'effective user' since if there are two accounts, say 'foo' and
'bar', and both have a userid of 1234 and 'bar' is located ahead of 'foo'
in the /etc/passwd file, then cron will run as 'bar' even though the
crontab file is named 'foo'.

That aside, I think your issue is that the effective user cron is running
your job as is not able to write the file. (i.e. it is not running as user
65534).

Solutions:
1. run the cron job as user 65534.
2. run the cron job and sudo to userid 65534
3. open the permissions on xxx.png to 666

-david-



.



Relevant Pages

  • Re: PHP and cron jobs
    ... I help out at a gaming website, where we play BF2 and track player stats/give them awards etc. I've got a whole backend and everything works exactly as I need... ... except for when I need to update the awards via cron job. ... e.g. if you have a crontab file named 'foo', then crontab will run as the effective user 'foo'. ...
    (comp.lang.php)
  • Re: Path And cron
    ... settings in the crontab; LOGNAME may not. ... Given that the default shell is /bin/sh, are the settings ... PATH settings for all cron users so I don't have to edit each users' ... crontab file when file locations are updated or changed. ...
    (freebsd-questions)
  • crontab
    ... crontab file I'm using the MAILTO flag to get cron to email me every ... Is there any way of instructing cron to only email me if the cron job ... Stuart Gibson ... images, an easy-to-use design, ‘Lightbox’ facilities for improved ...
    (freebsd-questions)
  • Re: a cron problem
    ... I have trouble with a cron job, ... for db in `cat liste` ... tar -cf $tar * ...
    (comp.unix.shell)
  • Re: foxpro 2 for Unix and cron jobs.
    ... running the cron as which user? ... you may want to set up the cron job, instead of just ONE line - as a ... name, but it wasn't 'foxpro'. ... Mondo Cool TeleCom -> http://www.efgroup.net/efgcog.html ...
    (microsoft.public.fox.helpwanted)