Question

I want to make a cronjob to send reminders to the users about something ??

I am using codeigniter framework with modules approach.

This is my last try :

0 7 3 * * /usr/bin/php index.php cli/cart_reminder

Although i use modules but i make a separate controller in Controllers folder

This is my code :

class Cart_Reminder extends CI_Controller {

    function __construct() 
    {
        parent::__construct();
        $this->load->library('input');
        $this->load->library('email');
        $this->load->model('cart_reminder_model','cart_reminder');
    }

    public function index()
    {
//         if(!$this->input->is_cli_request())
//      {
//          echo "greet my only be accessed from the command line";
//          return;
//      }

        $emails=$this->cart_reminder->get_emails();

        foreach($emails as $em):
          $msg=$em['bo_name'].'\r\n';
          $msg.="هذه الكتب قد فمت بإضافتهالسلة المشتريات من قبل ولم تقم بإكمال عملية الشراء لإكمال عملية الشراء اضغط هنا ";
          $msg.="<a href='".base_url()."paypal/cart'>اضغط هنا</a>";
          $this->email->to($em['user_email']);
          $this->email->from($this->option->get('site_email'));
          $this->email->subject("رسالة تذكير");
          $this->email->message($msg);
          $this->email->send();      

        endforeach;
    }


}

Now it doesn't work and send me as admin this mail :

/usr/local/cpanel/bin/jailshell: 0: command not found

No correct solution

OTHER TIPS

Two things you will need to do (from the command prompt):

1) Insure that PHP is indeed located @ /usr/bin/php

/usr/bin/php --version

2) Add the full path to the crontab entry:

0 7 3 * * /usr/bin/php /home/users/test.com/index.php cli/cart_reminder

Finally once you have that command set, do the following to insure it actually works:

>cd $HOME
>/usr/bin/php /home/users/name/sites/test.com/index.php cli/cart_reminder
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top