Jump to content

Recommended Posts

Posted
I found articles: https://docs.blesta.com/display/dev/Plugin+Cron+Tasks and https://docs.blesta.com/display/user/System+%3E+Automation#System>Automation-RunningtheCronManually and I see example code from /var/www/blesta/plugins/auto_cancel/auto_cancel_plugin.php . I don't want to run a job every day and don't want to bother with the install code for this.... I've got a plugin working via the web site, but need to run it from CLI (Command Line Interface).

 

I just want to create my own Linux Cron job that runs once a month, so I am wondering what I need for the command line [sudo crontab -e]:

@monthly "/usr/bin/php index.php /plugin/hourly/main/invoices/"

 

Sorry, I don't have direct access to the server to play with the path, or I wound not be asking how to do this. I've looked at the file /var/www/blesta/config/routes.php, but an stuck... It looks like the path may need to be something like: admin/api/plugin/hourly/main/invoices/ ? Any pointers on this?

 

Here is my /var/www/blesta/plugins/hourly/controllers/main.php controller file:

class Main extends HourlyController {

 

  public function preAction() {

    parent::preAction();

  }

 

  public function invoices() {

    Loader::loadModels($this, array("Hourly.HourlyInvoice"));

    $this->HourlyInvoice->start_invoices();

  }

 

}

Posted

You will add your plugin to /blesta/plugins/  foldler ,here is developer doc. https://docs.blesta.com/display/dev/Creating+a+Plugin

 

Example

 

/blesta/

  /plugins/ your_plugin/

                 controllers/

                 models/

                 views/

                 controller.php

                 config.json

                 ...etc

  • 5 weeks later...
Posted

Thanks, Nelsa. I was able to make my plugin work via the site now, but am stuck on how to get it to work on the Console (Command Line Interface for Linux).

 

What should I try for the /usr/bin/php index.php [PATH to the controller]? /plugin/hourly/main/invoices/ works on the site, but I'm not familiar enough with how Blesta routes the plugin via command line.  

Posted

Thanks, Nelsa. I was able to make my plugin work via the site now, but am stuck on how to get it to work on the Console (Command Line Interface for Linux).

 

What should I try for the /usr/bin/php index.php [PATH to the controller]? /plugin/hourly/main/invoices/ works on the site, but I'm not familiar enough with how Blesta routes the plugin via command line.  

 

 

normally for the cron you should use another controller rather than the admin controller , so the admin controller need to be the admin logged in to work .

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...