无法使用 rc.local 和存档 .sh 运行 Django 应用程序

问题描述

嗨,我正在尝试在 raspBerry 上实现我的程序的自动执行,我阅读了一些教程,他们谈到使用带有 .sh 扩展名的文件并编辑 rc.local 文件,我已经创建了名为 autorunser 的文件。 sh 并修改 rc.local 文件,但它不起作用,我不知道我是否做错了什么,我使用“源 autorunser.sh”调用 autorunser.sh 文件并且程序可以运行,但是我的调用来自rc.local 文件不起作用。

我在 rc.local 文件中的代码是这样的:

#!/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.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi
source /home/pi/autorunser.sh
exit 0

我在 autorunser.sh 文件中的代码如下:

#!/bin/bash

cd /home/pi/pidjango/market
source ../djenv/bin/activate
python manage.py  runserver 

exit 0

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)