zoukankan      html  css  js  c++  java
  • ubuntu开启emqx/nginx/uwsgi自启动服务

    一、emqx开机自启

    a.首先在执行如下命令

     vi /lib/systemd/system/emqx.service

    创建了emqx.service文件然后在文件中写入如下内容
     

        [Unit]
        Description=emqxautostart
        After=network.target
        [Service]
        Type=forking
         
        Environment=HOME=/opt/emqx
        ExecStart=/opt/emqx/bin/emqx start
        ExecReload=/opt/emqx/bin/emqx restart
        ExecStop=/opt/emqx/bin/emqx stop
        PrivateTmp=true
        [Install]
        WantedBy=multi-user.target

    注意其中的

    1. Environment=HOME=/opt/emqx
    2. ExecStart=/opt/emqx/bin/emqx start
    3. ExecReload=/opt/emqx/bin/emqx restart
    4. ExecStop=/opt/emqx/bin/emqx stop

    需要修改为自己的路径

    保存退出后我的的服务已经好了接下来可以使用

    1. systemctl start emqx.service
    2. systemctl stop emqx.service

    进行启动停止服务

    我们还需要将服务添加到自启动那么需要执行如下

    systemctl enable emqx.service

    reboot试一下,会发现开机能够自启动

    二、nginx开机自启

    vim /lib/systemd/system/nginx.service
    Description=nginx - high performance web server
    After=network.target remote-fs.target nss-lookup.target
    [Service]
    Type=forking
    ExecStart=/usr/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ExecReload=/usr/sbin/nginx -s reload
    ExecStop=/usr/sbin/nginx -s stop
    [Install]
    WantedBy=multi-user.target

    systemctl enable nginx.service

    三、uwsgi开机自启

     vim /lib/systemd/system/summary.service

     

    [Unit]
    Description=uWSGI instance to serve summary
    After=network.target
     
    [Service]
    User=lufficc
    Group=www-data
    WorkingDirectory=/your/path/summary
    Environment=FLASKR_SETTINGS=/your/path/summary/env.cfg
    ExecStart=/usr/local/bin/uwsgi --ini //your/path/summary/uwsgi.ini 
    [Install]
    WantedBy=multi-user.target

    systemctl enable summary.service

  • 相关阅读:
    HUD --- 3635
    leetcode380- Insert Delete GetRandom O(1)- medium
    leetcode68- Text Justification- hard
    leetcode698- Partition to K Equal Sum Subsets- medium
    leetcode671- Second Minimum Node In a Binary Tree- easy
    leetcode647- Palindromic Substrings- medium
    leetcode633- Sum of Square Numbers- easy
    leetcode605- Can Place Flowers- easy
    leetcode515- Find Largest Value in Each Tree Row- medium
    leetcode464- Can I Win- medium
  • 原文地址:https://www.cnblogs.com/yangyangming/p/13850844.html
Copyright © 2011-2022 走看看