zoukankan      html  css  js  c++  java
  • 用systemd脚本自动启动node js程序

    vi /usr/lib/systemd/system/pano.service

    [Unit]
    Description=pano - main site of site_name.com
    Documentation=http://www.site_name.com/docs/
    
    [Service]
    ExecStart=/usr/local/bin/node /www/www.site_name.com/node/bin/www
    ExecStop=/bin/kill -s QUIT $MAINPID
    Restart=always
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=nobody
    User=nobody
    Group=nobody
    Environment=NODE_ENV=production
    
    [Install]
    WantedBy=multi-user.target
    # systemctl enable pano
    # systemctl start pano

    nginx的启动脚本/usr/lib/systemd/system/nginx.service

    [Unit]
    Description=nginx - high performance web server
    Documentation=http://nginx.org/en/docs/
    After=network.target remote-fs.target nss-lookup.target
     
    [Service]
    Type=forking
    PIDFile=/run/nginx.pid
    ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
    ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
    ExecReload=/bin/kill -s HUP $MAINPID
    ExecStop=/bin/kill -s QUIT $MAINPID
    PrivateTmp=true
     
    [Install]
    WantedBy=multi-user.target
  • 相关阅读:
    sort color (荷兰国旗)
    先序遍历和后序遍历构建二叉树
    二叉树的遍历
    排序
    内存相关内容
    chrome控制台console方法表
    记一次移动端CSS引发的小Bug
    JavaScript的事件
    浅谈webpack打包原理
    JS模块化进程
  • 原文地址:https://www.cnblogs.com/afxcn/p/4013714.html
Copyright © 2011-2022 走看看