Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
你能在JBoss Fuse的Karaf终端中运行脚本文件吗?_Jboss_Terminal_Jbossfuse_Karaf - Fatal编程技术网

你能在JBoss Fuse的Karaf终端中运行脚本文件吗?

你能在JBoss Fuse的Karaf终端中运行脚本文件吗?,jboss,terminal,jbossfuse,karaf,Jboss,Terminal,Jbossfuse,Karaf,Karaf*终端允许在提示时编写一些命令脚本。例如: $.context bundles | grep-i felix ,可能包含在一个文件中 我的问题很简单:如何从终端运行karaf语言脚本文件?对于我的应用程序,脚本可以是本地文件 非常感谢 *:JBoss Fuse 6.1.0.rehat-379您可以像这样使用shell:source命令: 下面是一个示例脚本 computer:karaf donald$ cat test.script bundle:list -t 0 | head

Karaf*终端允许在提示时编写一些命令脚本。例如:

$.context bundles | grep-i felix

,可能包含在一个文件中

我的问题很简单:如何从终端运行karaf语言脚本文件?对于我的应用程序,脚本可以是本地文件

非常感谢

*:JBoss Fuse 6.1.0.rehat-379

您可以像这样使用shell:source命令:

下面是一个示例脚本

computer:karaf donald$ cat test.script  
bundle:list -t 0 | head
echo 'Hello world 1'
echo 'Hello world 2'
echo 'Hello world 3'
下面是如何从karaf调用它:

Cobalt:bin donald$ ./karaf 
        __ __                  ____      
       / //_/____ __________ _/ __/      
      / ,<  / __ `/ ___/ __ `/ /_        
     / /| |/ /_/ / /  / /_/ / __/        
    /_/ |_|\__,_/_/   \__,_/_/         

  Apache Karaf (3.0.2)

Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.

karaf@root()> shell:exec pwd
/Users/donald/apache-karaf-3.0.2
karaf@root()> shell:exec ls
LICENSE
NOTICE
README
RELEASE-NOTES
bin
data
demos
deploy
etc
instances
lib
lock
system
test.script
karaf@root()> shell:source test.script
START LEVEL 100 , List Threshold: 0
ID | State    | Lvl | Version         | Name                                                               
-----------------------------------------------------------------------------------------------------------
 0 | Active   |   0 | 4.2.1           | System Bundle                                                      
 1 | Active   |   5 | 2.2.0           | OPS4J Pax Url - aether:                                            
 2 | Active   |   5 | 2.2.0           | OPS4J Pax Url - wrap:                                              
 3 | Active   |   8 | 1.7.4           | OPS4J Pax Logging - API                                            
 4 | Active   |   8 | 1.7.4           | OPS4J Pax Logging - Service                                        
 5 | Active   |  10 | 3.0.2           | Apache Karaf :: Service :: Guard                                   
 6 | Active   |  10 | 1.8.0           | Apache Felix Configuration Admin Service                           
Hello world 1
Hello world 2
Hello world 3
karaf@root()> 

创建一个文件并一次性添加所有要运行的fuse命令 .从karaf使用命令shell:source


非常好的例子,我确实需要将test.script发送给启动karaf的用户,脚本第一行中的bundle:list命令是JBoss Fuse 6.1.0.rehat-379中的osgi:list,但除此之外,它还起到了作用!谢谢。