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 jswak (Here is how you can install jswak on MAC)
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)}'
(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 jswak (Here is how you can install jswak on MAC)
- http://www.macports.org/install.php
- http://johnattebury.com/blog/2011/06/spidermonkey-jsawk-resty-on-snow-leopard
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)}'
Hi Yogesh,
ReplyDeleteI am using install command -
C:\Users\ssha49\Desktop\infra scripts>curl -X POST -v -F "action=install" -F "bundlestart=start" -F "bundlestartlevel=20" -F "bundlefile=C:\Users\ssha49\Desktop\gsamjars\search-1.1.jar" http://admin:admin@localhost:4502/system/console/bundl
es
but I am getting error -
* About to connect() to localhost port 4502 (#0)
* Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 4502 (#0)
* Server auth using Basic with user 'admin'
> POST /system/console/bundles HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.28.1
> Host: localhost:4502
> Accept: */*
> Content-Length: 506
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------
030db4
>
< HTTP/1.1 100 Continue
< HTTP/1.1 302 Moved Temporarily
< Connection: Keep-Alive
< Server: Day-Servlet-Engine/4.1.24
< Content-Type: text/html
< Date: Mon, 04 Feb 2013 09:51:22 GMT
< Transfer-Encoding: chunked
< Location: /system/console/bundles
* HTTP error before end of send, stop sending
This page moved to /system/console/bundles
* Closing connection #0
I just updated CURL command. Can you try now ?
DeleteHi Yogesh, I have tried the same curl command to install a jar in AEM but I am also getting the same error as that of Mr. Sujeeth. Can you help me regarding this.
DeleteCan you please use curl -u admin:PASSWORD -F action=install -F bundlestart=start -F bundlestartlevel=20 -F bundlefile=/path/to/jar/file.jar http://HOST:PORT/system/console/bundles Let me know if that helps. Also what version of CQ are you using ?
DeleteExcellent post, Yogesh. Is it be possible to refresh bundle configuration with CURL as well?
ReplyDeleteYes. You can refresh bundle as well. I have command for that listed above. Let me know if that does not work. Note that you need to use bundle symbolic name for that.
DeleteHi Yogesh, for bundle, we can just update/ activate/update via package: /apps/${app}/install/${bundle-file-name}
ReplyDeleteany implications on doing that?
sometimes i noticed that the bundle is not being updated. is it because of the version on META-INF? or anything else?
Hello Mildred,
DeleteBundle only get update if new bundle version is either greater than current installed bundle version or it is same as current installed version but have SNAPSHOT in version number.
For example,
Current is 1.0.0 and new is 1.0.1 -> update happen
Current is 1.0.2 and new is 1.0.1 -> update will not happen
Current is 1.0.2 and new is 1.0.1-SNAPSHOT -> update will not happen
Current is 1.0.2 and new is 1.0.2-SNAPSHOT -> update will happen
Current is 1.0.2-SNAPSHOT and new is 1.0.2-SNAPSHOT -> update will happen
Current is 1.0.2-SNAPSHOT and new is 1.0.1-SNAPSHOT -> update will not happen
Yogesh
Hi Yogesh ,
ReplyDeleteDo you know how to create a cq node with Long type ?
Hello Madhavan,
DeleteDo you mean create a node with Long property ? For that you can use sling post servlet. Here is example http://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html
Yogesh
Hi Yogesh,
ReplyDeleteI tried the command but not sure if it ran successfully or not. I did not receive any response to the command.
I do not have access to Felix console, so
- Is there a way to find out if a particular bundle exists or got installed
- To star the bundles, how to find the bundle symbolic name
For bundle symbolic name just query bundles.json and then use any json parser tool to find it.
DeleteDo we have any cURL command to check the status of the bundle? If so,could you please suggest. Thanks in advance.
ReplyDeleteHello Swathi,
DeleteYou can use curl with jswak to check this. I have added some example for your reference above. Please let me know if that helps.
Yogesh
Wheely | The largest platform to play wheely online games in 2019. We have a number of fun games for kids both boys and girls.http://wheelygames.com/
ReplyDelete