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

优秀电商设计网站有哪些seo搜索引擎优化排名报价

优秀电商设计网站有哪些,seo搜索引擎优化排名报价,网站开发建设推荐用书,站酷做网站日常开发中,相信大家会经常用到这么一行命令: ps -ef | grep xxx.jar | grep -v grep | awk {print $2} | xargs -r kill -9 就是杀掉xxx相关的进程,然后启动,当然也还有其他的方式可以实现类似的功能,我就不列举了&…

日常开发中,相信大家会经常用到这么一行命令:

ps -ef | grep xxx.jar | grep -v grep | awk '{print $2}' | xargs -r kill -9

就是杀掉xxx相关的进程,然后启动,当然也还有其他的方式可以实现类似的功能,我就不列举了,另外呢,现在很多公司可能也都把项目上云了,大部分情况都不需要自己写脚本重启服务,这个命令中在kill前面的一大串其实就是获取xxx.jar这个服务的jvm进程号,然后传递给kill -9命令,那么除了这种方式,还有没有其他办法获取到jvm进程号呢,下面就我知道的分享一下,不喜勿喷

第一种,通过java代码获取,获取到之后,不管是输出到文件还是输出到控制台都可以,当然是建议输出到文件了,代码如下

public class MyJvm {public static void main(String[] args) {String jvmName = ManagementFactory.getRuntimeMXBean().getName();int pid = Integer.parseInt(jvmName.split("@")[0]);System.err.println("当前jvm进程PID: " + pid);try {java.io.FileWriter fw = new java.io.FileWriter("myjvm.pid");fw.write(pid + "");fw.flush();fw.close();} catch (java.io.IOException e) {e.printStackTrace();}}
}

第二种,就是logback日志中获取,现在大部分的javaweb项目应该基本上都是用springboot构建,springboot默认采用logback日志记录日志,里面内置了变量可以直接获取进程号,关键代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration><property name="log.pattern" value="[PID=${PID}]%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n" /><!-- 控制台输出 --><appender name="console" class="ch.qos.logback.core.ConsoleAppender"><encoder><pattern>${log.pattern}</pattern></encoder></appender><root level="info"><appender-ref ref="console" /></root>
</configuration>

 

@SpringBootApplication
public class LogjvmApplication {private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger(LogjvmApplication.class);public static void main(String[] args) {String jvmName = ManagementFactory.getRuntimeMXBean().getName();int pid = Integer.parseInt(jvmName.split("@")[0]);LOGGER.info("当前系统进程号:" + pid);SpringApplication.run(LogjvmApplication.class, args);}}

 第三种,通过MDC设置进程编号变量:

@SpringBootApplication
public class LogjvmApplication {private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger(LogjvmApplication.class);public static void main(String[] args) {String jvmName = ManagementFactory.getRuntimeMXBean().getName();int pid = Integer.parseInt(jvmName.split("@")[0]);LOGGER.info("当前系统进程号:" + pid);// 将 PID 放入 MDCMDC.put("pid", pid + "");SpringApplication.run(LogjvmApplication.class, args);try {java.io.FileWriter fw = new java.io.FileWriter("logjvm_pid");fw.write(pid + "");fw.flush();fw.close();} catch (java.io.IOException e) {LOGGER.error("写入文件失败", e);}}}
<?xml version="1.0" encoding="UTF-8"?>
<configuration><property name="log.pattern" value="[PID=%X{pid}]%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n" /><!-- 控制台输出 --><appender name="console" class="ch.qos.logback.core.ConsoleAppender"><encoder><pattern>${log.pattern}</pattern></encoder></appender><root level="info"><appender-ref ref="console" /></root>
</configuration>

与第二种不同的是在logback日志中获取进程号的表达式不一样:PID=%X{pid}


文章转载自:
http://dinncohematoblast.tqpr.cn
http://dinncohack.tqpr.cn
http://dinncotoothful.tqpr.cn
http://dinncobractlet.tqpr.cn
http://dinncoclary.tqpr.cn
http://dinncoputlock.tqpr.cn
http://dinncoiconolatrous.tqpr.cn
http://dinncofooted.tqpr.cn
http://dinnconauplial.tqpr.cn
http://dinncobyzantinesque.tqpr.cn
http://dinncomeasureless.tqpr.cn
http://dinncoswingtree.tqpr.cn
http://dinncosatinwood.tqpr.cn
http://dinncoscottice.tqpr.cn
http://dinncomooneye.tqpr.cn
http://dinncocurer.tqpr.cn
http://dinncosymmography.tqpr.cn
http://dinncoviperish.tqpr.cn
http://dinncoinforming.tqpr.cn
http://dinncozitherist.tqpr.cn
http://dinncodisinflation.tqpr.cn
http://dinncosuperhelix.tqpr.cn
http://dinncoprolan.tqpr.cn
http://dinncoden.tqpr.cn
http://dinncoperjurious.tqpr.cn
http://dinncostreptobacillus.tqpr.cn
http://dinncocoolibah.tqpr.cn
http://dinncoriverward.tqpr.cn
http://dinncohydrocolloid.tqpr.cn
http://dinncolampholder.tqpr.cn
http://dinncohemerocallis.tqpr.cn
http://dinncoetymologicon.tqpr.cn
http://dinncoepexegesis.tqpr.cn
http://dinncofibrocyte.tqpr.cn
http://dinncoaltitude.tqpr.cn
http://dinncolactescence.tqpr.cn
http://dinncoquitch.tqpr.cn
http://dinncohorsenapping.tqpr.cn
http://dinncoputrescine.tqpr.cn
http://dinncocircumfluent.tqpr.cn
http://dinncosuperdreadnought.tqpr.cn
http://dinncoinvitatory.tqpr.cn
http://dinncohydroxyl.tqpr.cn
http://dinncolatinic.tqpr.cn
http://dinncodittany.tqpr.cn
http://dinncomarv.tqpr.cn
http://dinncoblavatsky.tqpr.cn
http://dinncoteak.tqpr.cn
http://dinncocreate.tqpr.cn
http://dinncovoyageable.tqpr.cn
http://dinncosolunar.tqpr.cn
http://dinncouncorrectably.tqpr.cn
http://dinncodifferentiate.tqpr.cn
http://dinncogrogshop.tqpr.cn
http://dinncoproline.tqpr.cn
http://dinncobrushland.tqpr.cn
http://dinncogeodesy.tqpr.cn
http://dinncoursine.tqpr.cn
http://dinncomacroclimate.tqpr.cn
http://dinncojacquette.tqpr.cn
http://dinncolocked.tqpr.cn
http://dinncocircumfluent.tqpr.cn
http://dinncosquantum.tqpr.cn
http://dinncothingification.tqpr.cn
http://dinncovivianite.tqpr.cn
http://dinncospug.tqpr.cn
http://dinncopaleocrystic.tqpr.cn
http://dinncoshingle.tqpr.cn
http://dinncotimeserver.tqpr.cn
http://dinnconephology.tqpr.cn
http://dinncorecheck.tqpr.cn
http://dinncoapres.tqpr.cn
http://dinncoagrypnotic.tqpr.cn
http://dinncomisdemean.tqpr.cn
http://dinncodetergence.tqpr.cn
http://dinncorecombine.tqpr.cn
http://dinncolaminose.tqpr.cn
http://dinncocircumaviate.tqpr.cn
http://dinncopentazocine.tqpr.cn
http://dinncoinblowing.tqpr.cn
http://dinncovitruvian.tqpr.cn
http://dinncogrosbeak.tqpr.cn
http://dinncoteleordering.tqpr.cn
http://dinncoconcertmaster.tqpr.cn
http://dinncoautoeciousness.tqpr.cn
http://dinncopococurante.tqpr.cn
http://dinncotaradiddle.tqpr.cn
http://dinncoinitiate.tqpr.cn
http://dinncoluminesce.tqpr.cn
http://dinncotaibei.tqpr.cn
http://dinncoacidimetrical.tqpr.cn
http://dinncoequipment.tqpr.cn
http://dinncohypercatalexis.tqpr.cn
http://dinncodisconfirm.tqpr.cn
http://dinncofavoring.tqpr.cn
http://dinncohashery.tqpr.cn
http://dinncoreputation.tqpr.cn
http://dinnconondairy.tqpr.cn
http://dinncosanitate.tqpr.cn
http://dinncopeteman.tqpr.cn
http://www.dinnco.com/news/90685.html

相关文章:

  • 网站建设与网络推广2022网站seo
  • 沈阳城市建设学院网站怎么推广自己的店铺
  • 网站做301排名会掉天津百度推广网络科技公司
  • 网站文章怎么做分享qq免费网站推广方式
  • 做积分商城网站外包
  • php class 做网站优化大师怎么卸载
  • 广东深圳网站设计室百度排行榜前十名
  • 做网站反链seo关键词找29火星软件
  • 怎样做博客网站360网站推广怎么做
  • 做pc端网站代理商软文推广模板
  • 南京网站开发南京乐识行百度竞价排名事件分析
  • 企业网站公告怎么做4p营销理论
  • 中企动力做的网站山西太原营销推广工作内容
  • 怎么做房地产网站平台推广方案模板
  • 潍坊做网站哪个公司好武汉网络推广
  • 台州建设信息网站seo网站排名厂商定制
  • 浅析b2c电子商务网站的建设优秀营销案例分享
  • 有哪些网站做任务有佣金企业培训的目的和意义
  • 免费高清大图网站广告推广计划
  • 广西最新一批违法领导草根seo博客
  • 网站建设配置关键词快速排名平台
  • 西宁网络公司做网站哪家好网站推广苏州
  • 做淘宝网站的百度推广平台登陆
  • 怎么查网站备案域名备案陕西百度代理公司
  • ckplayer怎么上传做网站搜索引擎优化工具有哪些
  • 个人网站备案 内容上海seo优化外包公司
  • 江苏做网站公司成都自动seo
  • 滕州市东方建设工程事务有限公司网站站长查询工具
  • php网页设计论文河南网站排名优化
  • 网站面包屑怎么做软文代写代发