• 成功启动linux下的service-记录


    启动linux下的service-记录

    1.写好.service文件

    示例

    [Unit]
    Description=django_server, a WebServer.
    After=syslog.target
    
    [Service]
    # 执行命令,用uwsgi启动django
    ExecStart=/usr/local/bin/uwsgi --ini /data/test/django_server/uwsgi.ini 
    
    # 指定工作目录
    RuntimeDirectory=/data/test/django_server/
    WorkingDirectory=/data/test/django_server/
    
    Restart=always
    KillSignal=SIGQUIT
    Type=notify
    StandardError=syslog
    NotifyAccess=all
    PIDFile=/var/run/django_server.pid
    
    [Install]
    WantedBy=multi-user.target
    

    2.复制或新建service文件

    path >>> /etc/systemd/system/

    # 先cd到项目目录
    cp django_server.service /etc/systemd/system/
    

    3.重载service文件,

    systemctl daemon-reload
    

    4.加入开机启动

    systemctl enable django_server.service
    

    5.查看service状态或启动

    # 查看状态
    service django_server status
    
    # 启动service
    service django_server start
    

    tips

    不能正常起来的情况下,很有可能是service内容有问题,要仔细排查日志和内容,比如运行的cmd或目录等。
    
  • 相关阅读:
    Leetcode 83. Remove Duplicates from Sorted List
    Leetcode 61. Rotate List
    Leetcode 24. Swap Nodes in Pairs
    增强式学习
    散布矩阵
    特征选择
    CouchDB
    echarts和matplotlib
    特征缩放
    K-means、SLC、EM
  • 原文地址:https://www.cnblogs.com/davis12/p/14336399.html
Copyright © 2020-2023  润新知