Linux下开机启动python脚本详解
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
应用场景:
最近在服务器上部署一些脚本,需要让其随服务器开机启动,于是研究了一下,begin . . .
解决方法:
1. 先准备好需要开机启动的脚本 /root/test/qin.py
2. 一定root权限编辑文件/etc/rc.local,在exit 0之前编辑开机启动脚本的命令
/usr/local/bin/python3 /root/test/qin.py > /root/test/qin.log
exit 0
3. 需要检查前面的python3执行环境是否有问题,这里解释一下,/usr/local/bin/python3 和 /usr/bin/python3都可以,有时/usr/bin/python3可能不存在,可以用软连接ln -s /usr/local/bin/python3 /usr/bin/python3,然后就可以了
4. 最后直接reboot重启后,发现log生成
尝试结果:
通过Linux命令查看当今程序是否持续执行
ps -aux|grep 'qin.py'
OK,有问题留言!




A beautiful web dashboard for Linux
最近提交(Master分支:7 天前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
更多推荐
所有评论(0)