<!-- 當前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(); } }