zoukankan      html  css  js  c++  java
  • Centos7 .Net Core 使用Supervisor守护进程,进行后台运行

    1.安装supervisor

    yum install supervisor 

    2.配置supervisor

    vim /etc/supervisord.conf

     拉到最后,这里的意思是 /etc/supervisord.d 文件夹下的所有.ini结尾的文件都可以

    supervisor默认端口是9001,配置username和password,即可通过远程进行访问图形界面

    3.设置.net core运行配置

    在/etc/supervisord.d/目录下新建demo.init配置文件

    [program:demo]
    command=dotnet demo.dll  # 运行命令
    directory=/home/publish/demo/bin/Debug/netcoreapp3.1/publish # 程序路径
    environment=ASPNETCORE__ENVIRONMENT=Production
    user=root
    stopsignal=INT
    autostart=true # 自动启动
    autorestart=true
    startsecs=3
    stderr_logfile=/var/log/ossoffical.err.log
    stdout_logfile=/var/log/ossoffical.out.log

    4.运行supervisor

    supervisord -c /etc/supervisord.conf  #启动服务
    supervisorctl reload #重新加载配置
    supervisorctl shutdown #关闭
    systemctl enable supervisord #开机启动
    systemctl is-enabled supervisord #验证是否开机启动

    5.启动supervisor可能遇到的问题

    提示端口被暂用,其实并没有暂用,只是有supervisor进程在运行

    解决方案

    1.查看supervisor运行的进程

    ps -ef | grep supervisord

     2.kill掉supervisor的所有进程然后正常启动supervisor

    kill -s SIGTERM 26530 #数字为进程id
    
    supervisord -c /etc/supervisord.conf #启动supervisor

    最后就可以用远程访问图形界面来控制程序了

  • 相关阅读:
    样式
    读取网页图片(包含代理)
    C# 替换“换行符”写法
    Iframe中弹出消息问题
    程序list
    C#对象序列化
    软件工程——个人总结
    软件工程——团队作业4
    软件工程———团队答辩
    软件工程--团队作业三
  • 原文地址:https://www.cnblogs.com/ZhengHengWU/p/12581765.html
Copyright © 2011-2022 走看看