How to Check Whether a CRON Job Is Running on Your Server

3 min read
CRON automatically runs scripts on a schedule to send notifications, import data, clear temporary files, run agents and perform other background tasks.

Sometimes a job is configured and its schedule is correct, yet the script still does not run.

How can you tell whether CRON itself is working on the server?

The simplest approach is to create a separate PHP test script that appends the current date and time to a log file whenever it runs.

1. Create a PHP Test File

For example, create the following file in the website root:


cron-test.php

Add this code:


<?php

$logFile = __DIR__ . '/cron-test.log';

file_put_contents(
    $logFile,
    'CRON запущен: ' . date('Y-m-d H:i:s') . PHP_EOL,
    FILE_APPEND | LOCK_EX
);

Each time the script runs, a new line containing the current date and time is appended to cron-test.log .

For example:


CRON запущен: 2026-09-25 14:01:00
CRON запущен: 2026-09-25 14:02:00
CRON запущен: 2026-09-25 14:03:00

If the file is created and new lines appear on schedule, the system scheduler is working.

2. Configure the CRON Job

For testing, temporarily run the script every minute.

Example command:


* * * * * /usr/bin/php /home/user/www/site.ru/cron-test.php

Here:

* * * * * — runs the job every minute;
/usr/bin/php — is the path to PHP CLI on the server;
/home/user/www/site.ru/cron-test.php — is the full path to the test script.

Paths differ between servers, so do not simply copy the example command unchanged.

If you do not know the PHP path or the website's full path, check the server control panel or ask your hosting support team.

3. Check the Result

After adding the job, wait a few minutes and open:


cron-test.log

If new lines appear approximately once a minute:


CRON запущен: 2026-09-25 14:01:00
CRON запущен: 2026-09-25 14:02:00
CRON запущен: 2026-09-25 14:03:00

CRON is working correctly.

If the file has not appeared or remains empty, the problem is with the scheduler, the launch command or the paths to PHP and the script.

4. Test the PHP Script Manually

Before configuring CRON, test the PHP file from the command line.

For example:


/usr/bin/php /home/user/www/site.ru/cron-test.php

After running the command, a new entry should appear in cron-test.log.

If the script works manually but not through CRON, the scheduler configuration is the most likely cause.

If it also fails when run manually, CRON is not the cause. Fix the script or launch command first.

5. Find the PHP Path

On a server with SSH access, use this command to find PHP CLI:


which php

For example, the result might be:


/usr/bin/php

You can also check the PHP version:


php -v

A server may have several PHP versions installed. In that case, point CRON to the executable required by your website.

For example:


/usr/bin/php8.2 /home/user/www/site.ru/cron-test.php

6. What the Asterisks in CRON Mean

A standard schedule consists of five fields:


* * * * *
│ │ │ │ │
│ │ │ │ └─ day of the week
│ │ │ └─── month
│ │ └───── day of the month
│ └─────── hour
└───────── minute

Here are some examples.

Run every minute:


* * * * *

Run every hour:


0 * * * *

Run every day at 08:15:


15 8 * * *

Run every day at midnight:


0 0 * * *

Run every Sunday at 12:00:


0 12 * * 0

7. Where to Log CRON Errors

If the job starts but PHP returns an error, temporarily redirect its output to a separate file:


* * * * * /usr/bin/php /home/user/www/site.ru/cron-test.php >> /home/user/cron-error.log 2>&1

Standard output and PHP errors will then be written to:


cron-error.log

This makes it much easier to diagnose a script that works in a browser but fails through CRON.

Once the job works, you can suppress unnecessary output:


* * * * * /usr/bin/php /home/user/www/site.ru/script.php >/dev/null 2>&1

Do this only after testing, otherwise you may hide useful error messages along with the output.

8. Avoid Running CRON Through a Browser Unless Necessary

Some scheduled jobs use wget or curl:


wget -q -O - https://site.ru/cron.php

Or:


curl -s https://site.ru/cron.php

This approach is possible, but if PHP CLI is available, running the PHP file directly on the server is preferable.

The utility script then does not need to be publicly accessible, and its execution is less dependent on web server settings.

9. Remove the Test Files Afterwards

Once you have confirmed that CRON works, remove the test job or replace it with the real one.

Also remove the files:


cron-test.php
cron-test.log

if you no longer need them.

Quick CRON Test Checklist


1. Create a simple PHP script that logs its execution date.
2. Add it to CRON with a schedule of once per minute.
3. Wait a few minutes.
4. Check the log file.
5. If entries appear, CRON is working.
6. If there are no entries, check the PHP path, script path and error log.


This test quickly shows whether the problem lies with CRON itself, PHP or your production script.
Back to blog