Report this

What is the reason for this report?

Cron Job for Ubunto LEMP Stack

Posted on April 27, 2016

Simple cron job php script

<?php
$dir = '/usr/share/nginx/html/mobile-api/LoveIsTheAnswer';
if (!file_exists($dir)) {
    mkdir($dir, 0700, true);
}

Location: /usr/share/nginx/html/mobile-api/create.php

Crontab

1 * * * * /sur/share/nginx/html/mobile-api/create.php

My questions are.

  1. Any third party to install before running the cron job?
  2. The cron job does not working. Any missing code on the crontab?
  3. What crontab command to use in executing the create.php to test in putty before setting up to crontab file.

Thank you.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

replace cron with this:

* * * * * /usr/bin/php -q /usr/share/nginx/html/mobile-api/create.php

It’s not a PHP CLI script, so you need to tell it the interpriter to use, and you misspelled usr

Also, I don’t know what you’ve installed, so I can’t say what else you’ll need.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.