Cronjob is not running 😏


#1

I made a cron script located at /public_html/cron/script.php with this code:

<?php
  include('../includes/functions.php');

  foreach(get_sites_list() as $item){
    update_posts_list($item);
  }
  
  //Log to a txt file to make sure the script is executed
  date_default_timezone_set('Africa/Tunis');
  
  $log_message = 'Run at ' . date('Y-m-d H:i:s') . "\n";
  
  $file = fopen('log.txt', 'a+');
  
  fwrite($file, $log_message);

  fclose($file);

?>

It basically loops through the database and updates it.

Unfortunately, the script hasn’t been executed even once :smirk: I don’t know what’s wrong with it. I made sure it works properly by going to mywebsite.com/cron/script.php and saw the database and log file successfully updated.

Why 000webhost won’t execute it then?

P.S: functions.php is located under /public_html/includes/

@ckhawand More than 10 minutes have passed and still the cronjob hasn’t run :confused:


#2

Can you screenshot your cron jobs area in your cPanel?


#3

Here you go! I set it to execute every 10 minutes.


#4

Can you send me your account credentials so I can check that issue?
(I have set this topic to private)


#6

okay ~
email: *************
password: ***********


#7

I’ll check that now :slight_smile:


#8

I have modified some things, let’s wait 10 minutes and see what happens :slight_smile:


#10

Then, we’ll try something else,

  1. Take a backup of your website and database.
  2. Delete your website.
  3. Create a new one.
  4. Re-upload the files and the database.
  5. Creat a new cron-job :slight_smile: