skip to Main Content

My website hosting server is Godaddy and website is www.5kcinema.com
I am using codeigniter framework
I have a script that runs and check whether movie is released today or not, if released date is today’s date then movie is moved from upcoming movies to latest movies
My Controller file is Cron.php and function is index.

class Cron extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('listing_model');
    }

    public function index() {
        $tableName = 'movies_tbl m';
        $condition = "m.status=1 AND m.is_deleted=0 AND m.date_published='".date('Y-m-d')."'";
        $data = $this->listing_model->getAll($tableName, $condition, NULL, 1, 'object');

        if (count($data) > 0) {
            foreach ($data as $row) {
                $id = $row->id;
                $movie_data['mtype'] = 1;
                $this->listing_model->insert_update($tableName, $movie_data, $id); 
            }
        }
    }

}

I want this code to run in cron job every night at 12.01am

2

Answers


  1. You can use this

    1   0   *   *   *   /usr/local/bin/php /path-to-your-public_html/www.5kcinema.com/index.php cron
    
    Login or Signup to reply.
  2. you can choose cron time and then add this command

    /usr/bin/curl --user-agent cPanel-Cron http://www.5kcinema.com/Cron/index/
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search