A
A
ALDL2017-06-16 15:05:34
PHP
ALDL, 2017-06-16 15:05:34

Why is cron not running but not being processed?

Hello everyone, there is cron, if you go through the browser everything works, but through the crontab the script starts according to the logs, but nothing happens.

<?php
include(__DIR__.'/init.php');
foreach ($config as $index => $row) {
  $next_time = strtotime($row['interval']);
  $next_time -= $next_time % 60;
  $now = time();
  $now -= $now % 60;
  if ($now == $next_time) {	
    $filename = format_filename($row['url']);
    if (create_screenshot($row['url'], $filename)) {
      $config[$index] = array(
        'url'			=> $row['url'],
        'interval'		=> $row['interval'],
        'created_at'	=> $row['created_at'],
        'last_shot_time'	=> time(),
        'last_shot_file'	=> $filename,
      );
      update_config();
      echo(sprintf('create_screenshot: %s , %s'.PHP_EOL, $row['url'], $filename));
    } else {
      echo('create_screenshot fail!'.PHP_EOL);
    }
  }
}

I'm sure it's a small mistake, but I can't figure out where.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Boris Korobkov, 2017-06-16
@BorisKorobkov

Take a screenshot of the cron console - are you serious?

I
Inav, 2017-06-16
@Inav

cron has nothing to do with it, run the script itself in the console - php will give you an error

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question