<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Debian &#8211; ZhiZhi</title>
	<atom:link href="https://zhizhi.date/archives/category/debian/feed" rel="self" type="application/rss+xml" />
	<link>https://zhizhi.date</link>
	<description></description>
	<lastBuildDate>Wed, 18 Nov 2026 08:59:16 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>
	<item>
		<title>Debian使用Supervisor守护进程</title>
		<link>https://zhizhi.date/archives/55.html</link>
					<comments>https://zhizhi.date/archives/55.html#respond</comments>
		
		<dc:creator><![CDATA[eswan]]></dc:creator>
		<pubDate>Wed, 01 May 2024 10:44:27 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<guid isPermaLink="false">https://eswan.cc/?p=55</guid>

					<description><![CDATA[Supervisor 进程管理配置完全指南：从安装到常用命令速查 如果你需要在服务器上托管多个进程（比如 Ss [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h1 class="wp-block-heading">Supervisor 进程管理配置完全指南：从安装到常用命令速查</h1>



<p class="wp-block-paragraph">如果你需要在服务器上托管多个进程（比如 Ss、V2Ray 或者自定义脚本），一个轻量级的进程管理工具是必不可少的。今天博主就来聊聊 <strong>Supervisor</strong>，它用起来比 Systemd 简单太多，非常适合管理这类常驻应用。本文将详细介绍 Supervisor 的安装、配置方法，并提供可直接套用的配置模板和常用命令速查。</p>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading" id="mu-lu">目录</h2>



<div class="wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-f221bfd0 wp-block-group-is-layout-flex">

<ul class="wp-block-list">
<li><a href="#an-zhuang-supervisor">一、安装 Supervisor</a></li>
<li><a href="#pei-zhi-wen-jian-de-zheng-que-zi-shi">二、配置文件的正确姿势</a></li>
<li><a href="#pei-zhi-mo-ban">三、配置模板</a></li>
<li><a href="#kai-ji-qi-dong-yu-qi-dong-fu-wu">四、开机启动与启动服务</a></li>
<li><a href="#chang-yong-ming-ling-su-cha">五、常用命令速查</a></li>
<li><a href="#chang-jian-wen-ti-pai-cha">六、常见问题排查</a></li>
</ul>

</div>



<hr class="wp-block-separator"/>



<h2 class="wp-block-heading" id="an-zhuang-supervisor">一、安装 Supervisor</h2>



<p class="wp-block-paragraph">Supervisor 的安装非常简单。执行以下命令即可完成安装，建议先更新软件源以避免依赖问题：</p>



<pre class="wp-block-code"><code>apt-get update && apt-get install supervisor -y</code></pre>



<div class="wp-block-spacer" style="height: 20px;" aria-hidden="true"> </div>



<h2 class="wp-block-heading" id="pei-zhi-wen-jian-de-zheng-que-zi-shi">二、配置文件的正确姿势</h2>



<p class="wp-block-paragraph">Supervisor 的配置文件结构很清晰，主配置文件在 <code>/etc/supervisor/supervisord.conf</code>，一般情况下我们不需要修改它。</p>



<p class="wp-block-paragraph">真正需要操作的是 <code>/etc/supervisor/conf.d/</code> 目录。<strong>强烈建议</strong>为每个应用单独创建一个配置文件，比如为 Soga 脚本创建一个 <code>soga.conf</code>，这样做的好处是互不干扰，排查问题也更方便。</p>



<div class="wp-block-spacer" style="height: 20px;" aria-hidden="true"> </div>



<h2 class="wp-block-heading" id="pei-zhi-mo-ban">三、配置模板</h2>



<p class="wp-block-paragraph">下面是一份博主自用的配置模板，各位可以根据自己的实际情况修改路径和名称，直接套用即可：</p>



<pre class="wp-block-code"><code>[program:soga-ss]
command=/usr/local/soga/soga -c /etc/soga/soga-ss.conf
directory=/usr/local/soga/
user = root
stopsignal = INT
autostart = true
autorestart = true
startsecs = 1
stderr_logfile = /var/log/soga-ss.err.log</code></pre>



<p class="wp-block-paragraph"><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4cc.png" alt="📌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> 参数说明：</strong></p>



<ul class="wp-block-list">
<li><code>command</code>：你的启动命令，建议写绝对路径，避免环境变量问题。</li>
<li><code>directory</code>：程序运行的工作目录，很多坑都是因为没设置这个导致的。</li>
<li><code>autostart</code> / <code>autorestart</code>：设为 <code>true</code> 实现开机自启和崩溃自动重启，这才是使用 Supervisor 的核心目的。</li>
<li><code>stderr_logfile</code>：错误日志路径，程序运行异常时记得先查看这里。</li>
</ul>



<div class="wp-block-spacer" style="height: 20px;" aria-hidden="true"> </div>



<h2 class="wp-block-heading" id="kai-ji-qi-dong-yu-qi-dong-fu-wu">四、开机启动与启动服务</h2>



<p class="wp-block-paragraph">配置完成后，首先将 Supervisor 本身加入开机自启：</p>



<pre class="wp-block-code"><code>systemctl enable supervisor</code></pre>



<p class="wp-block-paragraph">然后启动 Supervisord 主进程：</p>



<pre class="wp-block-code"><code>supervisord -c /etc/supervisor/supervisord.conf</code></pre>



<p class="wp-block-paragraph">最后，把我们刚才配置的应用拉起来：</p>



<pre class="wp-block-code"><code>supervisorctl start all</code></pre>



<div class="wp-block-spacer" style="height: 20px;" aria-hidden="true"> </div>



<h2 class="wp-block-heading" id="chang-yong-ming-ling-su-cha">五、常用命令速查</h2>



<p class="wp-block-paragraph">下面这几个命令是日常运维中使用频率最高的，建议复制保存到笔记里，以备随时查阅：</p>



<pre class="wp-block-code"><code># 查看所有任务运行状态
supervisorctl status

# 新增或修改配置后，重新加载配置并重启
supervisorctl update
supervisorctl reload

# 单独重启某个程序
supervisorctl restart program_name

# 停止某个程序
supervisorctl stop program_name

# 关闭所有程序并退出Supervisor（慎用！）
supervisorctl shutdown</code></pre>



<div class="wp-block-spacer" style="height: 20px;" aria-hidden="true"> </div>



<h2 class="wp-block-heading" id="chang-jian-wen-ti-pai-cha">六、常见问题排查</h2>



<p class="wp-block-paragraph">如果程序启动失败，可以在终端输入 <code>supervisorctl status</code> 查看状态。如果看到 <code>EXITED</code> 或 <code>FATAL</code>，大概率是以下两个原因：</p>



<ul class="wp-block-list">
<li><strong>命令写错了</strong>：路径、空格、大小写都要仔细检查，确保与实际文件路径一致。</li>
<li><strong>工作目录不对</strong>：检查 <code>directory</code> 参数设置的目录是否存在，且运行用户是否有足够的权限访问。</li>
</ul>



<p class="wp-block-paragraph">如果查看日志后仍然无法解决问题，欢迎在评论区留言，看到会第一时间回复。</p>



<div class="wp-block-spacer" style="height: 40px;" aria-hidden="true"> </div>



<p class="wp-block-paragraph" style="text-align: center; font-style: italic; font-weight: 300;">觉得有用的话，记得收藏转发哦~</p>
]]></content:encoded>
					
					<wfw:commentRss>https://zhizhi.date/archives/55.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Debian安装Python 3.10</title>
		<link>https://zhizhi.date/archives/29.html</link>
					<comments>https://zhizhi.date/archives/29.html#respond</comments>
		
		<dc:creator><![CDATA[eswan]]></dc:creator>
		<pubDate>Sun, 03 Dec 2023 19:05:30 +0000</pubDate>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://eswan.cc/?p=29</guid>

					<description><![CDATA[更新程序包并安装编译依赖环境 开始正式安装]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">更新程序包并安装编译依赖环境</h2>



<pre class="wp-block-code"><code>apt update &amp;&amp; apt upgrade -y
apt install wget build-essential libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev -y
</code></pre>



<h2 class="wp-block-heading">开始正式安装</h2>



<ul class="wp-block-list">
<li>下载Python源码包</li>
</ul>



<pre class="wp-block-code"><code>cd
wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
</code></pre>



<ul class="wp-block-list">
<li>解压Python源码</li>
</ul>



<pre class="wp-block-code"><code>tar xzf Python-3.10.0.tgz</code></pre>



<ul class="wp-block-list">
<li>编译Python源码</li>
</ul>



<pre class="wp-block-code"><code>cd Python-3.10.0
./configure --enable-optimizations</code></pre>



<ul class="wp-block-list">
<li>安装Python 3.10</li>
</ul>



<pre class="wp-block-code"><code>make altinstall

</code></pre>



<pre class="wp-block-code"><code>apt update &amp;&amp; apt upgrade -y &amp;&amp; apt install wget build-essential libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev -y &amp;&amp; cd &amp;&amp; wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz &amp;&amp; tar xzf Python-3.10.0.tgz &amp;&amp; cd Python-3.10.0 &amp;&amp; ./configure --enable-optimizations &amp;&amp; make altinstall</code></pre>
]]></content:encoded>
					
					<wfw:commentRss>https://zhizhi.date/archives/29.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
