blob: f62adfabc05a0b1f73275d535442de2846c9a769 [file] [log] [blame]
h1. Starting and Stopping Karaf
This chapter describes how to start and stop Apache Karaf and the various options that are available.
h2. Starting Karaf
h3. On Windows
From a console window, change to the installation directory and run {{Karaf}}. For the binary distribution, go to
{code}
cd [karaf_install_dir]
{code}
where {{karaf_install_dir}} is the directory in which Karaf was installed, e.g., {{c:\Program Files\apache-karaf-x.y}}.
Then type:
{code}
bin\karaf.bat
{code}
h3. On Unix
From a command shell, change to the installation directory and run {{Karaf}}. For the binary distribution, go to
{code}
cd [karaf_install_dir]
{code}
where {{karaf_install_dir}} is the directory in which Karaf was installed, e.g., {{/usr/local/apache-karaf-x.y}}.
Then type:
{code}
bin/karaf
{code}
{warning:title=Warning}
Do NOT close the console or shell in which Karaf was started, as that will terminate Karaf (unless Karaf was started with nohup).
{warning}
h2. 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:
{code}
bin\karaf.bat server
{code}
or, on Unix:
{code}
bin\karaf server
{code}
h2. Starting Karaf in the background
Karaf can be easily started as a background process using the following command:
{code}
bin\start.bat
{code}
or, on Unix:
{code}
bin\start
{code}
h2. Starting Karaf from clean
Karaf can be reset to a clean state by simply deleting the {{\[karaf_install_dir\]/data}} folder.
For convenience, a parameter on the {{karaf}} and {{start}} scripts is available:
{code}
bin/start clean
{code}
h2. Stopping Karaf
For both Windows and Unix installations, you can perform a clean shutdown of Karaf by using the following command when inside a Karaf console:
{code}
osgi:shutdown
{code}
or simply:
{code}
shutdown
{code}
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:
{code}
osgi:shutdown -f
{code}
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, in which m is the number of minutes to wait. The work now is an alias for +0.
The following command will shutdown Karaf at 10:35am:
{code}
osgi:shutdown 10:35
{code}
The following command will shutdown Karaf in 10 minutes:
{code}
osgi:shutdown +10
{code}
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:
{code}
bin\stop.bat
{code}
or, on Unix:
{code}
bin/stop
{code}