mtaopsmon
that put these building blocks together (check out the section of the replay starting at around 14:55). I thought it would be worth sharing that script here, and explaining it bit by bit.#!/usr/bin/env bash
getopsid () { cf mta-ops | sed '1,3d' | head -1 | awk '{print $1}'; }
echo -n Searching for MTA operation
mtaopid=$(getopsid)
while [[ -z ${mtaopsid} ]]
do
echo -n .
sleep 1
mtaopsid=$(getopsid)
done
echo
echo MTA operation found: ${mtaopsid}
cf deploy -i ${mtaopsid} -a monitor
getopsid () { cf mta-ops | sed '1,3d' | head -1 | awk '{print $1}'; }
getopsid
that contains way to try and grab the ID of an MTA operation. This is deliberately over simplified but works for our purposes, and is a good start.cf mta-ops
gives for when there's an operation (or more than one), it looks like this:Getting active multi-target app operations in org p200135114trial / space dev as qmacro+workflowcodejam@example.com...
OK
id type mta id status started at started by
acb3bcda-8b7b-11ea-bb72-eeee0a890182 DEPLOY sample.onboarding.mta RUNNING 2020-05-01T07:16:28.294Z[UTC] qmacro+workflowcodejam@example.com
Getting active multi-target app operations in org p200135114trial / space dev as qmacro+workflowcodejam@example.com...
OK
No multi-target app operations found
getopsid
does. It calls cf mta-ops
, and pipes the output into sed '1,3d
', which will simply delete the first three lines. Whatever then remains is either nothing (there are only three lines when there are no MTA operations) or a list of operation details:acb3bcda-8b7b-11ea-bb72-eeee0a890182 DEPLOY sample.onboarding.mta RUNNING 2020-05-01T07:16:28.294Z[UTC] qmacro+workflowcodejam@example.com
head -1
which will just give us the first line.awk '{print $1}'
which will return just the first "field", i.e. the operation ID ("acb3...").getopsid
will return either an operation ID, or nothing.echo -n Searching for MTA operation
mtaopid=$(getopsid)
while [[ -z ${mtaopsid} ]]
do
echo -n .
sleep 1
mtaopsid=$(getopsid)
done
-n
option to echo
means), we call getopsid
and assign whatever it returns to the mtaopid
variable, which will therefore contain an ID, or nothing.-z ${mtaopsid}
condition is true, i.e. for as long as there's no value in the mtaopsid
variable. Inside the loop, we print a "." character, sleep for a second, and then call the getopsid
function again.echo
echo MTA operation found: ${mtaopsid}
cf deploy -i ${mtaopsid} -a monitor
mtaopsmon
script up, then switched over to the SAP Web IDE to deploy the "sample.onboarding.mta" MTA that I'd previously built.You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
10 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 |