- 后台启动脚本
nohup /usr/local/bin/python3 test.py > test.out &
/usr/local/bin/python3 python执行环境启动绝对路径 test.py 需要启动的脚本 test.out 错误信息输出文件
- 开机自启动
root权限编辑文件/etc/rc.local,在exit 0之前编辑开机启动脚本的命令
vim /etc/rc.local
nohup /usr/local/bin/python3 /root/test/test.py > /root/test/test.log &
exit 0
进程查看:
ps -aux|grep 'test.py'