zoukankan      html  css  js  c++  java
  • systemd 相关及服务启动失败原因

    1 查看启用的units

      systemctl list-unit-files | grep enabled

    2 查看指定服务的日志 按服务单元过滤

       journalctl -u j   查看j.service的日志  /输入shift+f 与tail -f等效 / 输入sfhit+g 到日志尾部

    3 增加工作目录

    #!/bin/sh -
    [Unit]
    Description=ATF Grafic Console
    
    [Service]
    
    WorkingDirectory=/home/pi
    ExecStart=/home/pi/launchscript.sh
    
    #ExecStart=-/RaspberryPi/ConsolaGrafica
    Restart=always
    
    #StandardOutput=syslogConsola               # Output to syslog
    #StandardError=syslogConsola                # Output to syslog
    
    [Install]
    WantedBy=multi-user.target

    启动服务失败的原因

    • wrong path to script (e.g. /home/py/ReadPressure2AndPostToMqtt.py)   错误的路径

    • script not executable    脚本没有可执行权限

    • no shebang (first line)   脚本第一行没有shebang   #!/bin/sh

    • wrong path in shebang (e.g. /bin/python3)   shebang是错的

    • internal files in your script might be missing access permissions.  脚本内部访问的文件没有权限

  • 相关阅读:
    Git常用命令
    maven profile动态选择配置文件
    Nodejs的偏函数
    用CountDownLatch来同步java的多线程
    NodeJS的Promise的用法
    alluxio常用命令
    常见小代码
    Mongodb
    Mysql_常用语法
    PostgreSQL
  • 原文地址:https://www.cnblogs.com/wolbo/p/11903467.html
Copyright © 2011-2022 走看看