Issue
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
Solution
You can use this
1 0 * * * /usr/local/bin/php /path-to-your-public_html/www.5kcinema.com/index.php cron
Answered By - Atal Prateek Answer Checked By - Dawn Plyler (WPSolving Volunteer)