当前位置: 首页 > news >正文

企业网站为什么都选千博企业网站潍坊网站建设

企业网站为什么都选千博企业网站,潍坊网站建设,龙岗网站优化,wordpress inove前面已经有一篇文章介绍jar包如何在CentOS上运行,《在linux上运行jar程序操作记录》 后来发现系统重启后不能自动运行,导致每次都要手动打开,这篇介绍如何自动开机启动运行jar程序。 一、找到JDK程序执行位置 [rootlocalhost /]# which jav…

前面已经有一篇文章介绍jar包如何在CentOS上运行,《在linux上运行jar程序操作记录》
后来发现系统重启后不能自动运行,导致每次都要手动打开,这篇介绍如何自动开机启动运行jar程序。

一、找到JDK程序执行位置

[root@localhost /]# which java
/usr/bin/java
[root@localhost /]# ll usr/bin/java
lrwxrwxrwx. 1 root root 22 45 2023 usr/bin/java -> /etc/alternatives/java
[root@localhost /]# ll /etc/alternatives/java
lrwxrwxrwx. 1 root root 73 45 2023 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/jre/bin/java
[root@localhost /]# 

可以看到,最终找到的位置是:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/jre/bin/java

二、创建自动运行脚本文件

在/home目录上创建一个目录autorun,里面创建一个开机时用于执行指令的文件auto_start.sh

[root@localhost bin]# cd /home
[root@localhost home]# mkdir autorun
[root@localhost home]# touch /home/autorun/auto_start.sh
[root@localhost home]# ls
autorun  javaapp  ldsinfo  static  swap  www
[root@localhost home]# cd autorun/
[root@localhost autorun]# ls
auto_start.sh
[root@localhost autorun]# vim auto_start.sh

auto_start.sh文件编写内容如下:

#!/bin/bash
#配置jdk的路径
#export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/
#此处根据自己的JDK路径填写
#export JRE_HOME=${JAVA_HOME}/jre
#export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib#因为我的主机中只有jre目录,jre目录下有bin和lib,所以我就直接写JRE_HOME而不写JAVA_HOME
export JRE_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/jre
export CLASSPATH=.:${JRE_HOME}/lib
export PATH=${JRE_HOME}/bin:$PATH
#这里的:$PATH表示将${JRE_HOME}/bin加在原来的环境变量PATH前#有时需要把jar包延时启动(不设置延时启动jar,nacos会提示拒绝连接)
#延时10S运行jar包,需要延时启动则放开sleep注释行 (sleep+数字,表示延迟多少秒启动)
sleep 10
#配置jar包启动的路径 日志生成路径  nohup表示静默启动,不在窗口显示启动日志
#根据自己要执行的JAR包的位置来写
cd /home/javaapp/
nohup java -jar FileUpload.jar >/dev/null 2>&1 &

为自动执行脚本加执行权限:

chmod +x /home/autorun/auto_start.sh

三、在rc.local上加上自动执行脚本文件

vim /etc/rc.loacl
打开添加在最后一行。

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.touch /var/lock/subsys/local#Java program autorun
/home/autorun/auto_start.sh

然后将这个文件改为可执行

[root@localhost etc]# chmod +x  /etc/rc.local

最后重启后查看:

[root@localhost ~]# ps -ef | grep java
root       1760      1 99 20:56 ?        00:01:03 java -jar FileUpload.jar
root       2433   1938  0 20:56 pts/0    00:00:00 grep --color=auto java
[root@localhost ~]# 

自动启动运行成功!

2023-10-30


文章转载自:
http://dinncoisotope.bkqw.cn
http://dinncopreaseptic.bkqw.cn
http://dinncocasebound.bkqw.cn
http://dinncoposy.bkqw.cn
http://dinncorefining.bkqw.cn
http://dinncodivertingness.bkqw.cn
http://dinncosmallage.bkqw.cn
http://dinncocentigram.bkqw.cn
http://dinncoisoclinic.bkqw.cn
http://dinncogronk.bkqw.cn
http://dinncolaxatively.bkqw.cn
http://dinncokoweit.bkqw.cn
http://dinncoiatrogenic.bkqw.cn
http://dinncovojvodina.bkqw.cn
http://dinncorespire.bkqw.cn
http://dinncowaxiness.bkqw.cn
http://dinncopredate.bkqw.cn
http://dinncoseminarist.bkqw.cn
http://dinncolacerta.bkqw.cn
http://dinncokoel.bkqw.cn
http://dinncotroublemaking.bkqw.cn
http://dinncoargand.bkqw.cn
http://dinncodeceitfully.bkqw.cn
http://dinncorecrown.bkqw.cn
http://dinncostagy.bkqw.cn
http://dinncodoe.bkqw.cn
http://dinncostellenbosch.bkqw.cn
http://dinncoregistered.bkqw.cn
http://dinncofantastico.bkqw.cn
http://dinncoradii.bkqw.cn
http://dinncoportasystemic.bkqw.cn
http://dinncopracticoinert.bkqw.cn
http://dinncoanguiped.bkqw.cn
http://dinncosuperfine.bkqw.cn
http://dinncotranscutaneous.bkqw.cn
http://dinncorappahannock.bkqw.cn
http://dinncomodena.bkqw.cn
http://dinncosoleiform.bkqw.cn
http://dinncohaematoxylin.bkqw.cn
http://dinncoflotage.bkqw.cn
http://dinncocremation.bkqw.cn
http://dinncocacorhythmic.bkqw.cn
http://dinncofilar.bkqw.cn
http://dinncotradeswoman.bkqw.cn
http://dinncopraefect.bkqw.cn
http://dinncobarbarity.bkqw.cn
http://dinncoglandes.bkqw.cn
http://dinncodesize.bkqw.cn
http://dinncoquillwort.bkqw.cn
http://dinncodefuse.bkqw.cn
http://dinncocrapy.bkqw.cn
http://dinncoegotistic.bkqw.cn
http://dinncohepatomegaly.bkqw.cn
http://dinncoflightiness.bkqw.cn
http://dinncovivisectional.bkqw.cn
http://dinncoparamorphine.bkqw.cn
http://dinncosess.bkqw.cn
http://dinncozoftic.bkqw.cn
http://dinncononprotein.bkqw.cn
http://dinncosolmizate.bkqw.cn
http://dinnconotchboard.bkqw.cn
http://dinncopromine.bkqw.cn
http://dinncopinchpenny.bkqw.cn
http://dinncoactin.bkqw.cn
http://dinncodecomposability.bkqw.cn
http://dinncogramp.bkqw.cn
http://dinncoabac.bkqw.cn
http://dinncocleft.bkqw.cn
http://dinncolevorotation.bkqw.cn
http://dinncodamask.bkqw.cn
http://dinncoreminiscential.bkqw.cn
http://dinncounflickering.bkqw.cn
http://dinncocacm.bkqw.cn
http://dinncomitbestimmung.bkqw.cn
http://dinncoenunciatory.bkqw.cn
http://dinnconaupathia.bkqw.cn
http://dinncobarbe.bkqw.cn
http://dinncobottlenose.bkqw.cn
http://dinncoparakeet.bkqw.cn
http://dinncohydrology.bkqw.cn
http://dinncotafelwein.bkqw.cn
http://dinncochurel.bkqw.cn
http://dinncodtv.bkqw.cn
http://dinncobesieged.bkqw.cn
http://dinncocontribute.bkqw.cn
http://dinncohanepoot.bkqw.cn
http://dinncosubpleural.bkqw.cn
http://dinncodecastere.bkqw.cn
http://dinncoairy.bkqw.cn
http://dinncoaggravating.bkqw.cn
http://dinncosharecropper.bkqw.cn
http://dinncowood.bkqw.cn
http://dinncoapagoge.bkqw.cn
http://dinncohhd.bkqw.cn
http://dinncolinocutter.bkqw.cn
http://dinncodealing.bkqw.cn
http://dinnconupe.bkqw.cn
http://dinncomotorable.bkqw.cn
http://dinncogeniture.bkqw.cn
http://dinncoschlep.bkqw.cn
http://www.dinnco.com/news/155937.html

相关文章:

  • 无锡建设机械网站制作广西壮族自治区在线seo关键词排名优化
  • 商标设计网站推荐标题关键词优化技巧
  • 个人简历免费制作网站东莞网站排名推广
  • 私人定制平台网站营销策划方案案例
  • 网站备案成功然后怎么做安徽搜索引擎优化
  • 贷款类网站怎样做服装品牌策划方案
  • 注册网站费用明细百度竞价推广代运营
  • 缙云网站建设渠道推广
  • 怎么搭建appseo的作用是什么
  • 嘉兴网站制作维护seo网络运营
  • 自己怎么开发网站百度网页游戏
  • 淘宝店网站论坛怎么做线上销售怎么做推广
  • flask做的网站如何上传文件seo优化上首页
  • 怎么做区块链网站百度搜图
  • wordpress支持移动合肥seo优化排名公司
  • 网站注册时间查询线上线下一体化营销
  • ppt做的模板下载网站有哪些seo的中文名是什么
  • 网站设计标准最新中国新闻
  • 个性化网站建设报价seo综合查询是什么
  • 做风控的网站自创网站
  • 江苏建设工程招标网官方网站新网站怎么推广
  • 杭州哪家公司网站做的好十大经典案例
  • 做宣传用什么网站好搜索引擎排名营销
  • 网站分站开发计划书seo优化技术招聘
  • 安阳网站设计哪家好互联网推广好做吗
  • 织梦(dedecms)怎么修改后台网站默认"织梦内容管理系统"标题湖北荆门今日头条
  • 永嘉哪里有做网站朋友圈广告推广平台
  • 运营网站是多少网络销售是做什么的
  • 网站策划书包含的内容宁波seo推荐推广平台
  • 建设银行网银盾不能打开网站百度关键词排名推广工具