Starting and Stopping Karaf
This chapter describes how to start and stop Apache Karaf and the various options that are available.
From a console window, change to the installation directory and run Karaf. For the binary distribution, go to
where karaf_install_dir is the directory in which Karaf was installed, e.g., c:\Program Files\apache-karaf-x.y.
From a command shell, change to the installation directory and run Karaf. For the binary distribution, go to
where karaf_install_dir is the directory in which Karaf was installed, e.g., /usr/local/apache-karaf-x.y.
Do NOT close the console or shell in which Karaf was started, as that will terminate Karaf (unless Karaf was started with nohup).
Starting Karaf without console
Karaf can be started without the console if you don't intend to use it (one can always connect using the remote ssh access) using the following command:
or, on Unix:
Starting Karaf in the background
Karaf can be easily started as a background process using the following command:
or, on Unix:
Starting Karaf from clean
Karaf can be reset to a clean state by simply deleting the data folder.
For convenience, a parameter on the karaf and start scripts is available:
In addition there might be situations where you need to restart the application from your application or dont have any
access to the service starting and stopping karaf. In this case you can either put an empty clean_cache or clean_all file
into the data folder. If you restart or start and stop Karaf then either the cache will be cleaned or the entire
data folder will be deleted.
You can restart Karaf directly from the command line by using:
Be careful since this does not start a new JVM but simply restarts the OSGi framework. If you want to clean your cache
or data directory during the reboot add the -c or -cc params to your build. Mor detailed information about the
restart parameters could be retrieved from the command line by using
For both Windows and Unix installations, you can perform a clean shutdown of Karaf by using the following command when inside a Karaf console:
The shutdown command asks you to confirm that you really want to shutdown. If you are sure about the shutdown and avoid the confirmation message, you can use the -f or --force option:
It's also possible to delay the shutdown using the time argument. The time argument can have different formats.
First, it can be an absolute time in the format hh:mm, in which hh is the hour (1 or 2 digits) and mm is the minute of
the hour (in two digits). Second, it can be in the format m (or +m), in which m is the number of minutes to wait.
The word now is an alias for 0.
The following command will shutdown Karaf at 10:35am:
The following command will shutdown Karaf in 10 minutes:
If you're running from the main console, exiting the shell using logout or Ctrl+D will also terminate the Karaf instance.
From a command shell, you can run the following command:
or, on Unix: