Send a mail through cron jobs using a controller |
[eluser]andrewpraveen[/eluser]
Hi, Andrew here, I just completed my website and now i m having a requirement to sent a every min mail to customer who have pending orders, suppliers who have pending orders, and admin will receive a status as well. I used to execute the below code for cron jobs. Code: wget --delete-after http://travablue.com/cron_jobs/jobs/ in the cpanel. but above code is using the http, therefore my server is getting delay for some time to response. therefore I tried to find a solution and got about CI method. therefore i gone through with all the blogs and forums and got the code as; Code: php /home/andrew/public_html/index.php cron_jobs jobs when i call a test.php in the public_html folder, it works, but this cron_jobs is a folder in the controller, and jobs is the controller as well. in the index function I m calling a model function as well which has the query and mail function. here the below is the controller file code; Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); but here in the cpanel i set up my email add to check the execution as well. I got the mails as below; Quote:Status: 301 Moved Permanently I m not sure where i m having the issue. In the code, or in the cron job ci calling command or in the .htaccess. Anyway i m giving the .htaccess file also. Code: DirectoryIndex index.php Any experts please let me know the fix... I m really need it as soon as possible.
[eluser]InsiteFX[/eluser]
Try this: Code: php /home/andrew/public_html/index.php/cron_jobs/jobs
[eluser]andrewpraveen[/eluser]
I got the alert mail saying! Status: 404 Not Found X-Powered-By: PHP/5.4.24 Content-type: text/html No input file specified.
[eluser]andrewpraveen[/eluser]
[quote author="andrewpraveen" date="1410057430"]I got the alert mail saying! Quote:Status: 404 Not Found[/quote]
[eluser]andrewpraveen[/eluser]
Any way I use the CURL method to do the job. but thanks for the help. I will try again this link. if it works definitly i will post you back .... thanks again.
[eluser]andrewpraveen[/eluser]
I used below command to do the job. Works fine. Code: php-cli /home/devtrava/public_html/index.php cron_jobs jobstest index All the best guys. I'm posting this experience in my blog too as tutorial. Lets check it up guys. http://apnlab.blogspot.com/ |
Welcome Guest, Not a member yet? Register Sign In |