设置开机启动
<p><strong>PyOne开机启动</strong>
创建<code>/etc/systemd/system/pyone.service</code>,内容为:</p>
<pre><code>[Unit]
Description=pyone
After=network.target
Wants=network.target
[Service]
Type=simple
PIDFile=/var/run/pyone.pid
WorkingDirectory=/root/PyOne
ExecStart=gunicorn -keventlet -b 0.0.0.0:34567 run:app
RestartPreventExitStatus=23
Restart=always
User=root
[Install]
WantedBy=multi-user.target</code></pre>
<p>注意修改<code>WorkingDirectory</code>为PyOne实际目录</p>
<p><strong>Aria2开机启动</strong>
创建<code>/etc/systemd/system/aria2.service</code>,内容为:</p>
<pre><code>[Unit]
Description=Aria2 server
After=network.target
Wants=network.target
[Service]
Type=simple
PIDFile=/var/run/aria2c.pid
ExecStart=/usr/bin/aria2c --conf-path=/root/.aria2/aria2.conf
RestartPreventExitStatus=23
Restart=always
User=root
[Install]
WantedBy=multi-user.target</code></pre>
<p><strong>开机启动</strong>
完成上面两步,继续设置开机启动</p>
<pre><code>systemctl enable pyone
systemctl enable aria2</code></pre>
<p><strong>启动服务</strong></p>
<pre><code>systemctl start pyone
systemctl start aria2</code></pre>