Crons

For each API instance we have to run various crons depending on the client and the environment.

We only run the crons on one API instance if there is more than one server for that group.

The cron files are deployed from S3 when the server is built, you can find then in the S3 dashboard by the following naming convention

// Patern
{client}-flow-config-{environnment}

// eg
jpi-flow-config-prod

// Cron location
jpi-flow-config-prod::/api/crons/

Cron Changes

There are different ways of changing the cron files on the server, the easiest is to upload the changes to the cron directory above and terminate the master server, when it rebuilds it will have your changes.

For the cases when you do not want to do that you can edit the files directly on the server in the /etc/cron.d/ directory, just remember to upload the same changes to the S3 directory.

Cron Files Prerequisites

Our API uses a few environment variables that are nopt exported for every user, this means we have to re-export them for crons.

A typical cron file looks like this

*/10 * * * * ubuntu . /home/ubuntu/exports.sh && bash -c 'env > /tmp/test' && cd /var/www/brightsites-api/web/sites/indy && /var/www/brightsites-api/vendor/bin/drush importPAIndy 590 20 20 > /tmp/importPAIndy

Remember to run the export.sh and cd into the correct folder if that cron is a drush.