【发布时间】:2017-12-31 03:10:17
【问题描述】:
我想知道解决此问题的最佳方法是什么。当 raspberry pi 加载到桌面时,我想运行一堆命令来运行一些 python 脚本和服务。这是我的命令:
cd /var/www/html/
python servocontrol.py
cd /var/www/html/Misc
python temp1.py
python seven_segment.py
sudo /etc/init.d/livestream.sh start
我在大多数帖子中阅读的初始方法是将其添加到 rc.local 中:
sudo nano /etc/rc.local
并在其中粘贴确切的命令,如下所示:
#
# 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
sleep 15
cd /var/www/html/
python servocontrol.py
cd /var/www/html/Misc
python temp1.py
python seven_segment.py
sudo /etc/init.d/livestream.sh start
exit 0
很遗憾,它没有用。如果有人可以指出我遗漏的内容,或者是否需要执行其他步骤才能使其正常工作,请多多关照。如果还有其他方法我也愿意接受!
谢谢
【问题讨论】:
标签: python linux raspberry-pi autostart init.d