-2

What permissions does a cron job run with on cPanel? Or even better, can I run a cron as a specific user? I had this working on a plesk panel but can't seem to get it going on cPanel.

I am trying to run a cron job for a Symfony project

    php-cli /home/appname/public_html/website/app/console appname:images:clean

Within this command in Symfony I am trying to log what I am doing. The error that I get back from the cron is:

  [UnexpectedValueException]
The stream or file "/home/appname/public_html/website/app/logs/dev.appname.log" could
not be opened: failed to open stream: Permission denied

The permissions on the file are

-rw-rw-r--+ cpaneluser:cpaneluser
Adam
  • 675
  • 5
  • 25
  • If you don't find an answer specific to cron jobs, you might find a solution here : http://stackoverflow.com/questions/36577020/failed-to-open-stream-no-such-file-or-directory – Vic Seedoubleyew May 06 '16 at 19:54

1 Answers1

0

You have probably added cron job to your own user's crontab instead of cpaneluser's one.

You can edit other user's crontab with:

crontab -u cpaneluser -e

And paste this cron job there.

Another solution could be to change the way you handle permissions in general, but that a bit more complex topic.

Jakub Matczak
  • 15,341
  • 5
  • 46
  • 64