设为首页 加入收藏

TOP

SUSE12Sp3-Supervisor 守护.net core进程
2019-09-17 18:01:33 】 浏览:16
Tags:SUSE12Sp3-Supervisor 守护 .net core 进程
1、安装setuptools

将setuptools-0.6c11.tar.gz安装包放到服务器上

tar zxvf setuptools-0.6c11.tar.gz   
cd setuptools-0.6c11
sudo python setup.py build
sudo python setup.py install
2、安装meld

将meld3-1.0.2.tar.gz安装包放到服务器上

tar -zxvf meld3-1.0.2.tar.gz
cd meld3-1.0.2
sudo python setup.py install
3、安装supervisor

将supervisor-3.3.3.tar.gz安装包放到服务器上

tar -zxvf supervisor-3.3.3.tar.gz
cd supervisor-3.3.3
sudo python setup.py install
4、验证supervisor安装是否成功
supervisorctl --help

如下,安装成功

supervisorctl -- control applications run by supervisord from the cmd line.

Usage: /usr/bin/supervisorctl [options] [action [arguments]]

Options:
-c/--configuration FILENAME -- configuration file path (searches if not given)
-h/--help -- print usage message and exit
-i/--interactive -- start an interactive shell after executing commands
-s/--serverurl URL -- URL on which supervisord server is listening
     (default "http://localhost:9001").
-u/--username USERNAME -- username to use for authentication with server
-p/--password PASSWORD -- password to use for authentication with server
-r/--history-file -- keep a readline history (if readline is available)

action [arguments] -- see below

Actions are commands like "tail" or "stop".  If -i is specified or no action is
specified on the command line, a "shell" interpreting actions typed
interactively is started.  Use the action "help" to find out about available
actions.
5、配置supervisor守护.net core 程序
sudo vi /etc/supervisord.conf #编写配置文件 
复制下面的内容到该文件,#号后面的 
[inet_http_server]
port=192.168.1.9:7004 ;这里要根据你的IP自行修改。也可以填写127.0.0.1,但是只能在本机访问了。

[program:WebApplicationl] ; program 后面接的是自己去的名字
command=dotnet WebApplication1.dll  ;这里是执行的命令
directory=/home/allspark/Downloads/Test ;这里是在哪个路径执行命令
user=root
stopsignal=INT
autostart=true   ;设置为true 子进程将在supervisord启动后被自动启动
autorestart=true ;设置子进程挂掉后自动重启
startsecs=1
stderr_logfile=/var/log/HelloWebApp.err.log ;这里是日志的路径
stdout_logfile=/var/log/HelloWebApp.out.log ;这里是日志的路径

[supervisord]

这里我们切换到root账号登录服务器,键入一下命令

supervisord -c /etc/supervisord.conf

访问ip:7004可以看到正在运行的项目

这时候也可以访问你程序的ip:端口进行访问


2019/7/5 11点01分 更新

这边添加一个脚本

#!/bin/bash
set -x

ip="127.0.0.1"

path="/home/allspark"

log_path="/var/log"

# 安装setuptools

tar zxvf setuptools-0.6c11.tar.gz

cd setuptools-0.6c11

sudo python setup.py build

sudo python setup.py install

cd ..

# 安装meld
tar -zxvf meld3-1.0.2.tar.gz

cd meld3-1.0.2

sudo python setup.py install

cd ..

# 安装supervisor

tar -zxvf supervisor-3.3.3.tar.gz

cd supervisor-3.3.3

sudo python setup.py install

supervisorctl --help

cd ..


# 编辑配置
cat >/etc/supervisord.conf <<-EOF

[inet_http_server]
port=${ip}:9001 ;

[program:取个名字] ;
command=你的命令 ;
directory=${path}/你要执行命令的目录 ;
user=root
stopsignal=INT
autostart=true   ;
autorestart=true ;
startsecs=1
stderr_logfile=${log_path}/日志名称.err.log ;
stdout_logfile=${log_path}/日志名称.out.log ;

 
[supervisord]
EOF


supervisord -c /etc/supervisord.conf

SUSE12Sp3 安装配置. net core 生产环境 - 总汇

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇.Net Core 实践 - 如何在控制台应.. 下一篇C# 操作Word目录——生成、删除目..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目