April 12, 2020
Estimated Post Reading Time ~

Using ticktick.sh to parse Json Responses from Adobe CQ5.5

ticktick.sh is a great little shell library that allows you to parse json responses from Adobe CQ. The following script is a simple example that pulls the current status of the installed, active and resolved bundles from the Felix System Console in Adobe CQ and presents the output. This can be used for example to check if the server is up and running. To use, download ticktick.sh, put it in the same folder as this script and run it.

The supported arguments are the credentials (admin:admin) and the url to the server root (http://localhost:4502). You should see a nice pink status line with the information on how many bundles are active, resolved and installed as well as an error code of zero if the server is up and a -1 if the server is still starting up.

curl -s -u $1 $2/system/console > /dev/null
if [ $? != 0 ]; then
echo admin console on $2 not running
exit -1
fi

. ./ticktick.sh

DATA=`curl -s -u $1 $2/system/console/bundles/.json`

tickParse "$DATA"

#echo ``status``
#echo current status total bundles: ``s[0]``, installed bundles: ``s[1]``, installed fragments ``s[2]``, bundles resolved ``s[3]``, bundles installed ``s[4]``

if [ ``s[4]`` = 0 ]; then

echo ``status``: server fully up
exit 0
else
echo -e "33[2A33[35m"
echo -n ``status``: server still activating bundles
echo -e "33[K33[0m"
exit -1
fi


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.