1

I am trying set cron job from php code:

file_put_contents('mycrontab.txt', '* * * * *  /usr/bin/php /home2/blabla/public_html/executable_file.php');

echo exec('crontab mycrontab.txt');

The above code not starts cron job, because when I am trying get current cron jobs

var_dump( shell_exec("crontab -l") );

result is NULL

P.S. Sorry if this question is very dumb, I am not know almost nothing about linux commands, including cron jobs.

Oto Shavadze
  • 34,391
  • 48
  • 116
  • 201
  • @JohnConde, examples (code) in my question, is exactly from the question, which you marked as duplicate, I am trying add cron job as showed `ajreal's` answer, though I can't start cron job. because asked I this question again – Oto Shavadze May 13 '14 at 18:54
  • FYI, `exec()` has a return value and two optionals arguments to collect error info. And many programs dump messages to stderr. – Álvaro González May 13 '14 at 19:08

0 Answers0