karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hendy Irawan (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-1226) Karaf Client cannot run a script
Date Sat, 25 Feb 2012 07:45:47 GMT

    [ https://issues.apache.org/jira/browse/KARAF-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13216358#comment-13216358
] 

Hendy Irawan commented on KARAF-1226:
-------------------------------------

Thank you Jean-Baptiste.

I'm also attempting to make it into Karaf primary launcher. The way it works is:
1. If the execute command or batch mode is enabled, it will start a thread that will monitor
bundles. Right now I'm using a periodic sleep (~100ms?) to check bundles, but it can be optimized
to only listen for bundle state change events.
2. Once all bundles are "stable" (i.e. nobody is STARTING or STOPPING), then it executes the
command(s), and shutdowns the runtime.

I still don't know how to bypass the branding and the prompt. i.e. I'd like to execute the
launcher in "exec" mode, not in interactive mode. Can you give me pointers ?

Since this will use args (which are currently ignored by Karaf, perhaps so that args can be
used fully by application integrator/downstream e.g. ServiceMix), I'll make it configurable,
perhaps adding a System property that is enabled by default, but can be disabled by e.g. ServiceMix.

However I'd be interested if later, this functionality can also be used by ServiceMix, i.e.
it should be possible for ServiceMix to process args, while retaining the functionality of
exec/batch mode built-in Karaf.
                
> Karaf Client cannot run a script
> --------------------------------
>
>                 Key: KARAF-1226
>                 URL: https://issues.apache.org/jira/browse/KARAF-1226
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 2.2.5
>         Environment: Ubuntu 11.10 64-bit, OpenJDK 6
>            Reporter: Hendy Irawan
>            Assignee: Jean-Baptiste Onofré
>         Attachments: KARAF-1226-client.patch, KARAF-1226-shell.patch
>
>
> Example usage:
> {code}
> echo osgi:ls | bin/client
> {code}
> or:
> {code}
> bin/client < commands.karafsh
> {code}
> or redirecting stdout to file:
> {code}
> echo osgi:ls | bin/client > bundles.txt
> {code}
> Expected outcome:
> 1. Output of the command printed to stdout
> 2. Banners etc. (if any) printed to stderr
> 3. Shell prompt should not be output at all
> 4. The client exits immediately
> Actual behavior:
> 1. All output including banners and the shell prompt are printed to stdout (only)
> 2. The client then hangs but still using around 20% CPU usage. It's not possible to Ctrl+C,
and need to kill the process.
> GNU tools (like bash) tend to detect the presence of an input stream, to differ between
interactive mode and a batch mode.
> If this is not possible, can also add a switch e.g. "--batch" or "-b" for "Batch mode".
> Note that the karaf "bin/shell" script already handles this quite nicely... by not hanging
after executing commands, and exits properly.
> BTW this should also be possible to do on karaf launcher itself (i.e. start Karaf, execute
command(s), then immediately shutdown the runtime).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message