Wednesday, April 29, 2015

Cron Job Manager in BlueBox

BlueBox now includes a Cron Job Manager which is a central resource for managing any scripts you want to automate in your BlueBox System.


The idea behind this tool is to provide a single point at which all regulary scripts are created and their activities and outputs are logged.

It can be found under Integration > Cron

In order to activate this module you will need to add the suggested line to the server's Cron File which will then trigger this engine, for example:

1 * * * * /usr/bin/wget -q -O /dev/null "http://www.sullycard.com/?class=bb_cron&method=run_cron&global[automate]=1"

This will run on the first minute of every hour, so your 'minute' settings (if used) will need to be 1 in order to trigger

Alternatively, use */5 * * * * to run it every 5 minutes, and your 'minute' settings can then be 0 or 5 or 10 or 15 etc

Or */15 * * * * to run it every 15 minutes etc.

It is suggested that the cron be left to run at the first minute past every hour (ie 1 * * * *) which will result in 24 ocurrences in a day.

Each time it runs it checks the list of entries in this new module and sees if it is appropriate to run each entry. Entries can be set to run on certain days of the month, days of the week, hours in the day and minutes in the hour. (Note that if you do set the value for 'minute' then your Cron File will need to be running at that minute in order for the script to trigger - so it is recommended to leave 'minute' blank and use the Cron File setting to run only on the first minute of every hour.)

Adding a Cron Job:


When adding an entry you will give it a name, and then select the class and function to run within the BlueBox System. You can also set various $global and $conf variables which will be passed to the system when it runs the function.

To restrict when your script runs you enter a combination of 
  • Day of Month (1 to 31) - if set it will only run on this day each month
  • Day of Week (Mon or Tue or Mon,Thu) - if set it will only run on these days each week
  • Hour (1-23) - if set it will only run at this hour each day
  • Minute (1-59) - if set it will only run at this minute each hour
So, to set a script to run daily at 1 minute past 3am:


And to set a script to run on Thursday and Saturday afternoons at 5 past 4pm:


You can enter email recipients to get a notification each time the script is run:


Lastly, you can pause a script which will stop it running while the pause is in place.




No comments:

Post a Comment