• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cron job localhost to cpanel

#1
Good day is there a way in codeigniter using cronjob that i will execute a process in controller like this in my localhost

<?php
class Tools extends CI_Controller {

    public function message($to = 'World')
    {
        echo "Hello {$to}!".PHP_EOL;
    }

    public function index() {
        echo "hoy";
    }

}

then i will  create a file for the output of that using cronjob then i will pass it to my cpanel file ?

full example


24 09 * * * php /var/www/codeigniter_folder/index.php tools message > ~/Desktop/output.php

instead of sending the output.php to my desktop i will send it to my cpanel file manager.

thank you in advance
Reply

#2
Does not the cPanel file manager just show files that are in /var/www ? Instead of writing the file to ~/Desktop, just write it to /var/www/codeigniter_folder/files/whatever/etc/...
Reply

#3
(08-09-2017, 09:46 AM)skunkbad Wrote: Does not the cPanel file manager just show files that are in /var/www ? Instead of writing the file to ~/Desktop, just write it to /var/www/codeigniter_folder/files/whatever/etc/...

what will i do in my system is from the localhost i will pass the data that i gather in localhost then using cronjob i will set an schedule and pass it to my cpanel.

so in my example

24 09 * * * php /var/www/codeigniter_folder/index.php tools message > ~/Desktop/output.php

from my localhost the path is  /var/www/codeigniter_folder/index.php tools message (im using linux as my OS)
the output of my controller tools with method message must create a file then will pass it to the cpanel file manager instead to my desktop
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.