linux安装jetty以及配置

dhso
2016/10/17 16:40
统计中

安装jetty程序

//下载jetty8
wget http://download.eclipse.org/jetty/8.1.17.v20150415/dist/jetty-distribution-8.1.17.v20150415.tar.gz
//解压jetty
tar xfz jetty-distribution-8.1.17.v20150415.tar.gz
//启动jetty
java -jar start.jar
//查看jetty帮助
java -jar start.jar --help

添加jetty自启动

//创建jetty启动文件
sudo touch /etc/init.d/jetty
//设置jetty启动权限
sudo chmod +x /etc/init.d/jetty
//编辑jetty启动文件
sudo nano /etc/init.d/jetty
//填入以下脚本命令
#!/bin/sh
### BEGIN INIT INFO
# Provides:          jetty
# Required-Start:    $network $local_fs $remote_fs
# Required-Stop::    $network $local_fs $remote_fs
# Should-Start:      $all
# Should-Stop:       $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: jetty service
# Description:       jetty service
### END INIT INFO

case "$1" in
start)
    echo "Starting jetty service ..\n"
    sudo /usr/java/jdk1.7.0_80/bin/java -DSTOP.PORT=8079 -DSTOP.KEY=secret -jar /usr/local/jetty/start.jar --daemon &
    #>logs/start.log 2>&1 &
    echo "Start jetty service done.\n"
    ;;
stop)
    echo "Stoping jetty service ...\n"
    sudo /usr/java/jdk1.7.0_80/bin/java -DSTOP.PORT=8079 -DSTOP.KEY=secret -jar /usr/local/jetty/start.jar --stop
    echo "Stop jetty service done.\n"
    ;;

esac
exit 0
//设置自启动
sudo chkconfig jetty on

本文为 dhso 原创

发布在 http://blog.minws.com/linuxan-zhuang-jettyyi-ji-pei-zhi/

如有转载,请标明来源!

作者信息
姓名:dhso
热评文章
最新评论
文章概览