0

I try to run cronjob, which execute php script and which also is added from php script.

I trying it on localhost. When php add cron, it is added as daemon user and job doen not execute. When I add the same cron as I or as root cron will execute. Is exist any perrmiosions for that?

In cron logs, there are the same logs for daemon,I and root users, withour errors.

In addition, when I add some other cron to daemon crontab for example:

* * * * * touch tmp/test.txt

then it will be work, and file will be created. I tried to change permiossions for files, but it not solved problem. What could be the reason of that?

2 Answers 2

1

you can edit a users crontab with -u.

e.g. edit crontab for www-data:

sudo crontab -u www-data -e
3
  • I know, but crons are correct i think, because its execute as my or root user, but as daemon user is not.
    – Filip
    Aug 3, 2015 at 8:20
  • mhh, okay. Maybe this is helpful: stackoverflow.com/questions/4421020/…
    – Henry
    Aug 3, 2015 at 8:52
  • also adding from php is ok, cron is added in daemon crontab (for example every files which are created in php script also are daemon own). Problem is, why cronjob which is in daemon crontab does not execute and the same cronjob which is for example in my crontab will be executed? I mean only cronjobs which execute php scripts, others jobs will execute in both crontabs
    – Filip
    Aug 3, 2015 at 9:14
1

ok, problem is solved. I put crontabs from txt file, which was generated from php. Php added on end of all lines '^M' which crashed jobs. I saw that when i opened crontab with vi editor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.