--- apache-karaf-2.2.4/src/shell/osgi/src/main/java/org/apache/karaf/shell/osgi/StopBundle.java.orig 2011-10-13 12:43:30.000000000 +0200 +++ apache-karaf-2.2.4/src/shell/osgi/src/main/java/org/apache/karaf/shell/osgi/StopBundle.java 2012-12-18 16:05:55.840492100 +0100 @@ -20,14 +20,22 @@ import org.osgi.framework.Bundle; import org.apache.felix.gogo.commands.Command; +import org.apache.felix.gogo.commands.Option; @Command(scope = "osgi", name = "stop", description = "Stop bundle(s).") public class StopBundle extends BundlesCommand { - + + @Option(name = "-t", aliases={"--transient"}, description="Keep the bundle as auto-start", required = false, multiValued = false) + boolean transientStop; + protected void doExecute(List bundles) throws Exception { for (Bundle bundle : bundles) { try { - bundle.stop(); + if (transientStop) { + bundle.stop(Bundle.STOP_TRANSIENT); + } else { + bundle.stop(); + } } catch (Exception e) { System.err.println(e.toString()); }