CodeIgniter Forums
Cronjob in CodeIgniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Cronjob in CodeIgniter (/showthread.php?tid=41218)



Cronjob in CodeIgniter - El Forum - 05-02-2011

[eluser]Sudz[/eluser]
How to set Cronjob in CodeIgniter?
Is there Any Tutorial or sample code?
Please suggest!!!!!!


Cronjob in CodeIgniter - El Forum - 05-02-2011

[eluser]Bigil Michael[/eluser]
in your cpanel there is one field to set cron job

there u pasted code like this

php /home/cpanel username/public_html/cron.php

and set execution time

put cron.php inside public html
sample cron.php
Code:
<?php
define('BASEPATH',1);
include('system/application/config/database.php');
include('system/application/config/config.php');
$con = mysql_connect($db['default']['hostname'],$db['default']['username'],$db['default']['password']);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db($db['default']['database'], $con);
    $current = date("Y-m-d ");
    mysql_query("update packages set status ='0' where valid_till = '$current'");
mysql_close();
?>



Cronjob in CodeIgniter - El Forum - 05-02-2011

[eluser]Ken Verhaegen[/eluser]
In the wiki of CI you'll find these pages:
"Cron Job Bootstrapper"
"Category Advanced -> Cronscript"


Cronjob in CodeIgniter - El Forum - 05-03-2011

[eluser]sblaas[/eluser]
Bootstrapper is no longer needed from version 2.x

[quote author="Ken Verhaegen" date="1304343859"]In the wiki of CI you'll find these pages:
"Cron Job Bootstrapper"
"Category Advanced -> Cronscript"[/quote]


Cronjob in CodeIgniter - El Forum - 05-04-2011

[eluser]Ken Verhaegen[/eluser]
[quote author="sblaas" date="1304441021"]Bootstrapper is no longer needed from version 2.x[/quote]

Good to know, I only used Google btw...