我在rc.local 最后一行加上了代码/usr/bin/python /home/ubuntu/run.py runserver 0.0.0.0:8923 &
在exit 0前面加的,但是还是不执行不知道怎么回事有人懂吗?求大神调教
ubuntu自启动py脚本呢?
答案:2 悬赏:0 手机版
解决时间 2021-02-12 04:58
- 提问者网友:锁深秋
- 2021-02-11 10:44
最佳答案
- 五星知识达人网友:忘川信使
- 2021-02-11 11:59
里面的代码写成这样的
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
就是下面这句 最后这个&字符表示后台启动
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
就是下面这句 最后这个&字符表示后台启动
全部回答
- 1楼网友:一秋
- 2021-02-11 12:27
首先确保 该脚本有执行权限
打开终端
chmod a+x /路径/xx.py
执行
python xxx.py
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯