April 1, 2020
Estimated Post Reading Time ~

How to manage bundle using curl command

Get bundle Symbolic Name:

(You can use jsawk tool to parse this data as well https://github.com/micha/jsawk)

curl -u admin:admin http://localhost:4502/system/console/bundles</bundlenumber>.json

Start
curl -u admin:admin -F action=start http://localhost:4502/system/console/bundles/$bundle symbolic name

Stop
curl -u admin:admin -F action=stop http://localhost:4502/system/console/bundles/$bundle symbolic name

Update
curl -u admin:admin -F action=update http://localhost:4502/system/console/bundles/$bundle symbolic name

Refresh
curl -u admin:admin -F action=refresh http://localhost:4502/system/console/bundles/$bundle symbolic name

Unistall
curl -u admin:admin -F action=uninstall http://localhost:4502/system/console/bundles/$bundle symbolic name
Or
curl -XDELETE -u user:pass http://.../apps/${app}/install/${bundle-file-name}

Install
curl -X POST -v -F action=install -F bundlestart=start -F bundlestartlevel=20 -F bundlefile=/path/to/jar/file.jar http://admin:admin@localhost:4502/system/console/bundles
OR
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F bundlefile=@"/path/of/jar" http://localhost:9002/system/console/bundles


Here is some example with jsawk (Here is how you can install jsawk on MAC)

http://www.macports.org/install.php
http://johnattebury.com/blog/2011/06/spidermonkey-jsawk-resty-on-snow-leopardHow to check if a CQ bundle is Active

curl -u admin:admin http://localhost:4502/system/console/bundles/<bundle number or symbolic name>.json | jsawk -n 'if(this.data[0].state=="Active")' | echo "Bundle is Active"

How to check if All bundles are active

curl -u admin:admin http://localhost:4502/system/console/bundles/<bundle number or symbolic name>.json | jsawk -n 'if(this.s[3] + this.s[4] > 0)' | echo "There is some problem not all bundle is active"

Find all Bundle having some problems

curl -u admin:admin http://localhost:4502/system/console/bundles.json | jsawk -n 'for(var i=0;i<this.data.length;i++) {if(this.data[i].state!="Active" && this.data[i].state!="Fragment") out("Bundle " + this.data[i].symbolicName+" is "+ this.data[i].state)}'


By aem4beginner

No comments:

Post a Comment

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