Ubuntu中通过SuperVisor添加守护进程
1. 用途
守护进程用于保持一个指定程序(dll)时刻保持运行。在命令行终端中通过dotnet run命令执行的程序,在退出命令行终端后,程序自动终止。添加守护进程后,即使终端退出,程序仍可后台执行。可用于执行定时任务。
2. 安装(环境:ubuntu 16.04 dotnet 2.1.104)
sudo apt-get install supervisor (必须在root下执行)
3. 修改配置文件
配置文件路径:/ect/supervisor/conf.d/supervisord.conf
直接修改该文件
gedit supervisord.conf
增加:
1)开启查看进程的界面
[inet_http_server]
port=127.0.0.1:7002
2)添加被守护的程序
[program:TimeTest]
command=dotnet TimeTest.dll ;要执行的指令
directory=/mnt/hgfs/Projects/TimeTest/bin/Debug/netcoreapp2.0/publish ;dll的路径
autostart=true
autorestart=true
numprocs=1
process_name=TimeTests ;名称
3)重启
supervisorctl reload
4)访问localhost:7002(与配置文件中的端口相同)即可查看当前正在运行的所有程序
配置文件完整示例:
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)_
[inet_http_server]
port=127.0.0.1:7002
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[program:TimeTest]
command=dotnet TimeTest.dll
directory=/mnt/hgfs/Projects/Linux/SurfaceRunoff/TimeTest/TimeTest/bin/Debug/netcoreapp2.0/publish
autostart=true
autorestart=true
numprocs=1
process_name=TimeTests
[include]
files = /etc/supervisor/conf.d/*.conf
4. 参考:
https://www.cnblogs.com/savorboard/p/dotnetcore-supervisor.html(给出的配置文件设置方法似乎有问题,添加后无法通过浏览器进行查看,也可能是版本问题,未再深究)
https://www.cnblogs.com/dingsblog/p/7040680.html(后来按这篇帖子完成配置文件修改)
Ubuntu中通过SuperVisor添加守护进程的更多相关文章
- Linux中的两种守护进程stand alone和xinetd
Linux中的两种守护进程stand alone和xinetd --http://www.cnblogs.com/itech/archive/2010/12/27/1914846.html#top 一 ...
- [Linux] PHP程序员玩转Linux系列-使用supervisor实现守护进程
1.PHP程序员玩转Linux系列-怎么安装使用CentOS 2.PHP程序员玩转Linux系列-lnmp环境的搭建 3.PHP程序员玩转Linux系列-搭建FTP代码开发环境 4.PHP程序员玩转L ...
- Ubuntu中找到并杀死僵尸进程
Ubuntu中产生zombie进程让人很懊恼啊.Windows中在任务管理器里直接找到无响应的进程并结束他就行了,但是ubuntu中需要用命令去解决. System information as of ...
- CentOS使用Ubuntu的start-stop-daemon来启动守护进程
在CentOS下使用守护进程启动有/etc/init.d/functions文件下的daemon方法,但如果要使用Ubuntu下的start-stop-daemon方法也可以实现. 安装如下: # 下 ...
- Laravel框架中实现supervisor执行异步进程
问题描述:在使用Laravel框架实现动态网页时,若有些操作计算量较大,为了不影响用户体验,往往需要使用异步方式去处理.这里使用supervisor和laravel自带的queues实现. Super ...
- Ubuntu中为Eclipse添加桌面启动快捷方式
Ubuntu中应用程序启动器“XXX.desktop”还没有被标记为可信任的问题:http://www.tuicool.com/articles/fIBJ32n eclipse问题:prefences ...
- .Net Core实战教程(三):使用Supervisor配置守护进程
安装Supervisor yum install python-setuptools easy_install supervisor 配置Supervisor mkdir /etc/superviso ...
- ubuntu中为Pycharm添加快捷启动方式
1. sudo gedit /usr/share/applications/Pycharm.desktop 2.在文件中添加: [Desktop Entry] Type=Application Nam ...
- 【Linux】- Ubuntu守护进程supervisor
linux的守护进程类似于windows的服务.linux通过supervisor创建守护进程. 1.安装supervisor sudo apt-get install supervisor 安装成功 ...
随机推荐
- 20164318 毛瀚逸-----EXP5 MSF基础应用
1. 实践内容 本实践目标是掌握metasploit的基本应用方式,重点常用的三种攻击方式的思路.具体需要完成: 1.1一个主动攻击实践,如ms08_067; (成功) 1.2 一个针对浏览器的攻击, ...
- Linux第六节课学习笔记
if条件测试语句可以让脚本根据实际情况自动执行相应的命令,可以分为单分支.双分支与多分支. /dev/null为无回收功能的垃圾箱. read是用来读取用户输入信息的命令,-p用来显示提示信息. fo ...
- java数据结构之链表(java核心卷Ⅰ读书笔记)
1.链表 数组和ArrayList的一个重大缺陷就是:从中间位置删除一个元素要付出很大的代价,因为在这个元素删除之后,所有的元素都要向前端移动,在中间的某个位置插入一个元素也是这个原因. (小感悟:s ...
- golang 修改数组中结构体对象的值的坑
对对象数组逐个修改元素属性时候没有成功,代码如下: for _, configure := range configures { configure.Price = specPriceMap[conf ...
- day059-60 ajax初识 登录认证练习 form装饰器, form和ajax上传文件 contentType
一.ajax 的特点 1.异步交互:客户端发出一个请求后,需要等待服务器响应结束后, 才能发出第二个请求 2.局部刷新:给用户的感受是在不知不觉中完成请求和响应过程. 二.ajax 模板示例 ($.a ...
- el-popover 的显示或隐藏,要在拿到真实dom之后再做控制
el-popover 的显示或隐藏,要在拿到真实dom之后再做控制
- 解决解决httpd: Could not reliably determine the server's fully qualified domain name
vi /etc/httpd/conf/httpd.conf 加入一句 ServerName localhost:80 参考:https://www.cnblogs.com/52linux/ar ...
- 承接小程序外包 微信小程序外包 H5外包 就找北京动点软件
承接小程序外包 微信小程序外包 H5外包 就找北京动点软件 长年承接微信小程序.微信公众号开发 全职的H5开发团队,开发过几十款微信小程序公众号案例 欢迎来电咨询 QQ:372900288 微信:li ...
- Ntrip协议简介(转)
原文地址:https://blog.csdn.net/sinat_19447667/article/details/67637167 1 什么是Ntrip? CORS(Continuously Ope ...
- Python之while循环
1.While循环基础 2.While循环进阶 3.其他