因为运行Django 希望uWSGI 开机自启动
- 在 /etc/init.d/ 下创建脚本文件 "uwsgi"
- 编写脚本
- # Provides: qsmoke-uwsgi
- 必填,且和其他自启应用名称不能冲突
#!/bin/sh
### BEGIN INIT INFO
# Provides: qsmoke-uwsgi
# Required-Start: $network $remote_fs $local_fs
# Required-Stop: $network $remote_fs $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: qsmoke-uwsgi
# Description: qsmoke-uwsgi Test Program
### END INIT INFO
if [ -f "/root/anaconda3/etc/profile.d/conda.sh" ]; then
. "/root/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/root/anaconda3/bin:$PATH"
fi
conda activate testqsmoke
uwsgi --ini /www/wwwroot/qsmoke/uwsgi.ini
echo "uwsgi yes !" >> /home/wason/qsmoke-uwsgi-log.txt
exit 0
添加自启:
update-rc.d uwsgi defaults 99
或者
/usr/sbin/update-rc.d uwsgi defaults 99
测试是否成功
/etc/init.d/uwsgi
或者
reboot
参考文章: