在apache karaf开始时运行命令的脚本 [英] script to run commands at start of apache karaf
问题描述
当我运行karaf时,我需要在其中安装一些功能.为此,我给出以下命令:
When i run karaf, i need to install some features into it. For that i give commands like:
install -s mvn:org.apache.derby/derby/10.8.2.2
feature:install jndi jpa transaction http
我想自动执行此操作,因为我想在重新启动时自行启动karaf.我已经阅读到可以使用wrapper:service在重新启动时启动它.但是我想到的下一个问题是我将如何发出这些命令.
I want to automate this thing as i want to start karaf by itself on reboot. I have read that i can start it on reboot by using wrapper:service. But next question to my mind is how will i give these commands.
我已阅读到可以使用 etc/shell.init.script 完成此操作.但我无法理解脚本页上的示例karaf网站.
I have read that it can be done using etc/shell.init.script. But i am not able to understand examples given on scripting page of karaf site.
我的karaf中shell.init.script文件的最后一行是:
Last lines on shell.init.script file in my karaf is:
help = { *:help $args | more } ;
man = { help $args } ;
log:list = { log:get ALL } ;
我应该在这些行下面简单地写这些命令,还是我需要写一些我不知道的函数,如脚本页面上给出的(下面给出一个).
Should i simply write these commands below these lines, or i need to write some functions like given on scripting page ( one is given below) of which i have no idea.
#
# Add a value at the end of a property in the given OSGi configuration
#
# For example:
# > config-add-to-list org.ops4j.pax.url.mvn org.ops4j.pax.url.mvn.repositories http://scala-tools.org/repo-releases
#
config-add-to-list = {
config:edit $1 ;
a = (config:property-list | grep --color never $2 | tac) ;
b = (echo $a | grep --color never "\b$3\b" | tac) ;
if { ($b trim) isEmpty } {
if { $a isEmpty } {
config:property-set $2 $3
} {
config:property-append $2 ", $3"
} ;
config:update
} {
config:cancel
}
}
推荐答案
研究了更多概念并进行了一些反复试验后,我发现这些命令可以写在脚本中,但必须使用其软件包指定(i不知道该怎么称呼它为包裹或捆绑包)
After studying some more concepts and doing some hit and trail i found these commands can be written in the script but, it has to be specified with its package( i dont know what to call it a package or a bundle)
这些命令可以以以下形式给出:
These commands can be given in this form:
bundle:install -s mvn:org.apache.derby/derby/10.8.2.2
feature:install jndi jpa transaction http
shell:echo "in script"
这篇关于在apache karaf开始时运行命令的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!