0

I am currently having an issue with creating files on my server due a cronjob. I use Direct Admin on a Linux server. This is my cronjob line:

/usr/local/bin/php /home/USER/domains/MYDOMAIN.COM/public_html/system/generate.php

The script basicly does this:

  1. Create a database record in table_1
  2. Update a row in the database in table_2
  3. Create a .zip file on the server.

When I run the script by myself it does all that. But once the cronjob runs the script it does everything except Step 3 (Create a .zip file on the server).

I'm running out of ideas, it has to be something with the cronjob because when I run the script myself it works perfect! Did I wrote the cronjob wrong? Do I need to add something to be able to write files on the server (something with cronjob permissions??).

jacoz
  • 3,508
  • 5
  • 26
  • 42
  • 1
    Either an issue with permissions (_which_ cronjob?) or with the current working directory the script is started in. – arkascha Nov 20 '13 at 07:59
  • 1
    @WiktorMociun What does `wget` have to do with this? – Barmar Nov 20 '13 at 08:01
  • Ohh sorry, my bad, didn't read your post with enough attention. Sorry for that. :) – Wiktor Mociun Nov 20 '13 at 08:04
  • True, this seems to be permission issue, http://stackoverflow.com/questions/8475694/how-to-specify-in-crontab-by-what-user-to-run-script, make sure you create the crontab as your current running user. – Risto Novik Nov 20 '13 at 08:05
  • Crontab is the cronjobline? Wich would make mine: crontab -u www-data -e /usr/local/bin/php /home/USER/domains/MYDOMAIN.COM/public_html/system/generate.php Am I right? :) – Rick Leijten Nov 20 '13 at 08:08

0 Answers0