资讯专栏INFORMATION COLUMN

让karaf随ubuntu开机启动

andong777 / 1448人阅读

摘要:最近帮助一个客户部署了一个环境。客户提出,能不能让开机启动。不需要让运维人员知道如何操作。需求合理,没有拒绝的理由。原以为设置个开机启动,和玩似的,结果被机器玩了。所以,第一眼在下看到官方的开机启动方案时,眼前一亮。

最近帮助一个客户部署了一个Apache Servicemix环境。
客户提出,能不能让Servicemix开机启动。这样,如果机器出现了什么问题,重启一下就好了。不需要让运维人员知道如何操作Servicemix。
当然可以。需求合理,没有拒绝的理由。

但是实际操作的时候,试过在init.d目录下加脚本,在rc.local中加命令行。在网上也找了好几个方法,均告失败,也没看到任何错误。原以为设置个开机启动,和玩似的,结果被机器玩了。

不过,功夫不负有心人,终于还是找到了办法。

因为servicemix其实就是一个开源大礼包,把几个apache的开源软件组装在一起拼凑而成。运行时环境是Karaf。所以,第一眼在karaf下看到官方的开机启动方案时,眼前一亮。觉得这个方法应该可行。结果一试,果然可以。

操作步骤也非常简单,摘抄如下(不过,还是去官网看一下更靠谱,网址:https://karaf.apache.org/manu...):

Installation
Apache Karaf Service Wrapper is an optional feature. You have to install the "Service Wrapper" installer first.

In the console:

karaf@root()> feature:install service-wrapper
Now, you have the wrapper:install command, to "register" Apache Karaf as service/daemon on your system:

karaf@root()> wrapper:install --help
DESCRIPTION
        wrapper:install

        Install the container as a system service in the OS.

SYNTAX
        wrapper:install [options]

OPTIONS
        -d, --display
                The display name of the service.
                (defaults to karaf)
        --help
                Display this help message
        -s, --start-type
                Mode in which the service is installed. AUTO_START or DEMAND_START (Default: AUTO_START)
                (defaults to AUTO_START)
        -n, --name
                The service name that will be used when installing the service. (Default: karaf)
                (defaults to karaf)
        -D, --description
                The description of the service.
                (defaults to )
The wrapper:install command detects the running Operating Service and provide the service/daemon ready to be integrated in your system.

For instance, on a Ubuntu/Debian Linux system:

karaf@root()> wrapper:install
Creating file: /opt/apache-karaf-4.0.0/bin/karaf-wrapper
Creating file: /opt/apache-karaf-4.0.0/bin/karaf-service
Creating file: /opt/apache-karaf-4.0.0/etc/karaf-wrapper.conf
Creating missing directory: /opt/apache-karaf-4.0.0/lib/wrapper
Creating file: /opt/apache-karaf-4.0.0/lib/wrapper/libwrapper.so
Creating file: /opt/apache-karaf-4.0.0/lib/wrapper/karaf-wrapper.jar
Creating file: /opt/apache-karaf-4.0.0/lib/wrapper/karaf-wrapper-main.jar

Setup complete.  You may wish to tweak the JVM properties in the wrapper configuration file:
        /opt/apache-karaf-4.0.0/etc/karaf-wrapper.conf
before installing and starting the service.


Ubuntu/Debian Linux system detected:
  To install the service:
    $ ln -s /opt/apache-karaf-4.0.0/bin/karaf-service /etc/init.d/

  To start the service when the machine is rebooted:
    $ update-rc.d karaf-service defaults

  To disable starting the service when the machine is rebooted:
    $ update-rc.d -f karaf-service remove

  To start the service:
    $ /etc/init.d/karaf-service start

  To stop the service:
    $ /etc/init.d/karaf-service stop

  To uninstall the service :
    $ rm /etc/init.d/karaf-service

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/68292.html

相关文章

  • Karaf(OSGi)+CXF荆棘之路

    摘要:笔者很菜,文章仅供自己复习使用,不专业之处请见谅。现在公司让用的框架,未来也许某天也会成为主流的吧,本文主要讲解如何简单使用进行开发。这里谈的是不是,两个技术名词长得很像却是两码事看错文章的朋友请打住。在标签下指定属性所对应的类。 吐槽:不断的JAVA新技术学习中,幸得笔者同事xunhua是大神,真的是大神级那种,一路抱大腿走过荆棘之路,真的可以用荆棘来形容Karaf(OSGi)+ C...

    hankkin 评论0 收藏0
  • Nexus3私有仓库搭建 docker+maven+npm

    摘要:安装号称是世界上最流行的私服管理软件可以搭建几乎目前所有常见的仓库如等更是增加了对仓库的支持应该是搭建私服的唯一选择有两个版本和其中版本是免费专业版需要收费对于日常的仓库管理已经足够用支持二进制文件安装和安装这里选择安装简单方便运行以下命令 安装 Nexus号称是世界上最流行的私服管理软件(The worlds most popular repository),可以搭建几乎目前所有常见...

    bang590 评论0 收藏0
  • 私有云部署-UCloudStack私有云部署之虚拟机

    摘要:虚拟网卡与虚拟机的生命周期一致,无法进行分离,虚拟机被销毁时,虚拟网卡即被销毁。每块虚拟网卡支持绑定一个安全组,提供网卡级别安全控制。平台默认提供块虚拟网卡,若业务有块以上网卡需求可通过绑定弹性网卡,为虚拟机提供多网络服务。虚拟机是 UCloudStack 云平台的核心服务,提供可随时扩展的计算能力服务,包括 CPU 、内存、操作系统等最基础的计算组件,并与网络、磁盘等服务结合提供完整的计算...

    ernest.wang 评论0 收藏0

发表评论

0条评论

andong777

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<