zoukankan      html  css  js  c++  java
  • shell脚本触发与程序日志打印位置

    针对近期的一个项目部署,每次通过一键启动脚本来启动程序时,发现日志都是生成在外层目录而不是程序目录里。

    如上图,本应在deploy/ecity-http目录下的log,生成在deploy目录下。

    执行脚本start-all如下:

    sh /home/ecity/deploy/eureka/start-eureka.sh
    sleep 15s
    sh /home/ecity/deploy/ecity-grpc/start-grpc.sh
    sleep 30s
    sh /home/ecity/deploy/ecity-http/start-http.sh
    是由delpoy目录下的总脚本触发分目录下的脚本。

    问题原因:日志生成目录为脚本执行目录。

    解决办法:1、修改程序日志生成目录为绝对路径,优点:简单,有效;缺点:每个不同的服务器下都得修改目录,比较繁琐

         2、脚本解决,先进触发脚本所在的目录,然后再去执行脚本。

    cd /home/ecity/deploy/eureka/
    sh start-eureka.sh
    sleep 15s
    cd /home/ecity/deploy/ecity-grpc/
    sh start-grpc.sh
    sleep 25s
    cd /home/ecity/deploy/ecity-http/
    sh start-http.sh

  • 相关阅读:
    Mysql主从同步延迟问题及解决方案
    elasticsearch 查询过程
    RPC(Remote Procedure Call):远程过程调用
    windows
    设计模式
    Linux Safe
    AS
    开机启动
    springboot打包部署
    【Linux】Linux 常用命令汇总
  • 原文地址:https://www.cnblogs.com/apollo-shen/p/7798020.html
Copyright © 2011-2022 走看看