<!-- 当前SSH 窗口下启动 --> java -jar rocketmq-console.jar >console.log 2>&1 & <!-- 后台启动 --> nohup java -jar rocketmq-console.jar & <!--指定日志文件名--> nohup java -jar rocketmq-console.jar > rocketmq.log 2>&1 &
命令解析:java
① & >> 后台呆着吧 (无视sigint信号:ctrl+c) ,前提是Shell 窗口还存活( sighup信号:关闭shell窗口)web
② nohup >> 不怕用户退出,shell关闭 (无视sighup信号) ,绝了,怕sigint信号:ctrl+c。spring
关于Linux信号列表,请自行google学习.
因此强强组合 就获得了 nohup ****** & shell
③ java -jar project_name.jar >> jar包方式启动命令服务器
④ > rocketmq.log >> 管道流输出日志到指定文件. 若是不指定直接在当前目录生成nohup.out,生成不了再去找$HOME/nohup.out . 再不行就废了.eclipse
⑤ 2>&1 >> 将标准错误重定向到标准输出 (这里标准输出是指定日志管道流,不指定就是nohup.out)spring-boot
java jar project_name.jar 学习
CrawlerBrandApplication.java 直接启动测试
运行 mvn spring-boot:run 等同于原始方式,经常还会遇到问题 >> 是否终止此批量处理方式 (mmp) google
好处是,只要配上不一样的端口就能够本地同时启动多个模块。
<!--jetty 容器启动--> <dependency> <groupId>org.eclipse.jetty.aggregate</groupId> <artifactId>jetty-all</artifactId> <version>9.2.19.v20160908</version> </dependency>
/** * @desc: 本地测试启动类 * @author: manji * 2018/3/21 23:39 */ public class OrderRestServer { public static void main(String[] args) throws Exception { // "8080" Server server = new Server(TradeEnums.RestServerEnum.ORDER.getServerPort()); //Handler {用SpringMVC的Handler} ServletContextHandler springMvcHandler = new ServletContextHandler(); // ”/order“ springMvcHandler.setContextPath("/"+TradeEnums.RestServerEnum.ORDER.getContextPath()); // 配置文件的引入 XmlWebApplicationContext context = new XmlWebApplicationContext(); context.setConfigLocation("classpath:xml/spring-web-order.xml"); springMvcHandler.addEventListener(new ContextLoaderListener(context)); springMvcHandler.addServlet(new ServletHolder(new DispatcherServlet(context)),"/*"); server.setHandler(springMvcHandler); server.start(); server.join(); } }