You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
biozshock edited this page Sep 14, 2010
·
2 revisions
Simple usage
To execute cli script every day at midnight n your controller you should put following code:
$this->load->library('crontab');
$this->crontab->add_job('0 0 * * *', 'cli_script.php');
This code will execute cli_script.php located in directory you’ve set up in config file at 0 minutes 0 hour
Advanced usage
Assuming you have in your $POST[‘time’] time when scheduled action should be performed.
$this->load->library('crontab');<br />
$time = $this->crontab->translate_timestamp(strtotime($this->input->post('time')), 's i G * *');
$this->crontab->add_job($time, 'cliscript.php’);
If you want to perform an action every day after user submit a data:
$this->load->library('crontab');
$time = $this->crontab->translate_timestamp(time(), 's i G * *');
$this->crontab->add_job($time, 'cli_script.php');