开发者

Plesk Cron jobs and FTP - who is the owner for file access?

Trying to setup a Cron task that gets a file via FTP however seems to fail due to file permissions.

Code runs perfect in the browser, ie when apache is the owner, howe开发者_JS百科ver fails when Cron runs the same page.

I'm assuming this is a directory/file permission error, if so who should I set the directory owner too for Cron jobs?


Most likely Dan's thought is going to be your problem. However if it works from a browser you can also call the page like this:

wget -q "http://www.domain.com/path/to/script/script.whatever" >/dev/null 2>&1

if you still get errors you can remove the >/dev/null 2>&1 part & [if your email address is in the domain administrator account correctly] output, including errors should get emailed to you.

As for the correct permissions, don't change the default plesk ones or you will get issues with normal ftp. Defaults are: everything under httpdocs = ftpuser.psacln anything written by php/apache = apache.apache ~ unless you are running php as a cgi on that domain,, then they will belong to the ftp user as well.

-sean


cron jobs will run as the user that created them. More likely than a permissions error is a path error. If you're not specifying full absolute paths to the program/script to run, and to any files you reference, you'll likely have problems as cron won't have the same PATH in its environment as Apache does or you do at your shell prompt.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜