You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Lukasz Lech <l....@ringler.ch> on 2018/09/11 07:20:06 UTC

Finding out if karaf has started

Hello,

I've tricked a lot by writing own bundle that installs features and then stops karaf.
The problem is, in new karaf, my bundle got restarted when I trigger feature installing, so I get interrupted exception, and the whole process fails.

If I'm going to return to classic solution, adding all features to boot features in or.apache.karaf.features.cfg, then I come to starting point, which made me trick so much: how can I find out, if karaf has started?
In my build environment, I have no database and other dependent systems, so there's no way all bundles will start, but the crucial point is, how can I find out that all bundles were installed and I can kill karaf?

In production environment, there will be no maven repository available, so all bundles must be installed when running build script.

I've used following script:

#!/bin/bash
export UPDATER_DISABLED=false                                                         # tell my bundle to run updates
export UPDATER_SHUTDOWN_WHEN_READY=true                     # tell my bundle to kill karaf afterwards
/opt/karaf/bin/karaf server                                                                     # run karaf, the call will return after my bundle is ready
STATUS=$?                                                                                                      # save status
rm -rf /home/karaf/.m2/repository                                                     # cleanup to minimize docker image size
cat data/log/karaf.log # debug output
rm -rf data/log ;
exit $STATUS

Any tips?

Best regards,
Lukasz Lech


Re: Finding out if karaf has started

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

I see two ways:

1. You can have the console one all bundles are started. In
etc/config.properties, just add:

	karaf.delay.console=true

2. Programmatically, you can check when the Karaf BootFinished appears.
It means that Karaf itself boot is complete.

Regards
JB

On 11/09/2018 09:20, Lukasz Lech wrote:
> Hello,
> 
>  
> 
> I’ve tricked a lot by writing own bundle that installs features and then
> stops karaf.
> 
> The problem is, in new karaf, my bundle got restarted when I trigger
> feature installing, so I get interrupted exception, and the whole
> process fails.
> 
>  
> 
> If I’m going to return to classic solution, adding all features to boot
> features in or.apache.karaf.features.cfg, then I come to starting point,
> which made me trick so much: how can I find out, if karaf has started?
> 
> In my build environment, I have no database and other dependent systems,
> so there’s no way all bundles will start, but the crucial point is, how
> can I find out that all bundles were installed and I can kill karaf?
> 
>  
> 
> In production environment, there will be no maven repository available,
> so all bundles must be installed when running build script.
> 
>  
> 
> I’ve used following script:
> 
>  
> 
> #!/bin/bash
> 
> export
> UPDATER_DISABLED=false                                                        
> # tell my bundle to run updates
> 
> export UPDATER_SHUTDOWN_WHEN_READY=true                     # tell my
> bundle to kill karaf afterwards
> 
> /opt/karaf/bin/karaf server
>                                                                     #
> run karaf, the call will return after my bundle is ready
> 
> STATUS=$?
>                                                                      
>                                # save status
> 
> rm -rf /home/karaf/.m2/repository                     
>                                # cleanup to minimize docker image size
> 
> cat data/log/karaf.log # debug output
> 
> rm -rf data/log ;
> 
> exit $STATUS
> 
>  
> 
> Any tips?
> 
>  
> 
> Best regards,
> 
> Lukasz Lech
> 
>  
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com