How to trigger a shell script before and after a deployment

One of my servers requires that I turn off the schedules before running a deployment, otherwise the 1 minute schedule will interfere with the deployment. I’m working on a server side script that will check for running schedules then disable any active schedules and then later re-enable them.

I need to call this as part of the deployment.

Toggle enabled schedules off
[ wait for running schedules to stop ]
[ write out the list of enabled schedule ids ]
[ disable the list ]
Run the deployment
Toggle schedules on

Is this something I can accomplish with OttoFMS. What are the steps?

Hey Rob,

At the moment the only way to run something right after the deployment ends would be to use the developer API to poll the deployment status and then run your script when the deployment finishes. You could build this polling into your script, you would essentially call the start deployment API and then use the IDs that get returned by it to loop and call for its status every 5 or 10 seconds. once its status returns as “complete” you should be able to re-enable your schedules.

I am planning on adding to the “chained action” functionality of deployments and build to send more generic API calls after a deployment finishes, which would let you run your script after being triggered in an API.

Let me know if that helps!

-Kyle

If it were me, I would look into the Admin API and OttoFMS API and I would use a FileMaker file to do thew following, using HTTP Requests.

  1. Call the Admin API to disable all scripts
  2. Call OttoFMS API to start the deployment, using the JSON that OttoDeploy can give you for your Deployment.
  3. Poll the OttoFMS API to see when the deployment was done.
  4. Call the Admin API to enable all schedules.

Here are some resources.

Easy way to send HTTP Scripts

Get the Amin API Docs and the OttoFMS API docs

Get the Deployment JSON from OttoDeploy after you have configured your Deployment

This gives you the most control.

Todd

2 Likes