我有一个树莓派3 - 模型B,与Raspbian jessie操作系统。 我试图在启动时打开“铬”。如何使用Raspberry Pi 3在启动时运行铬?
我写了一个简单的脚本:
#!/bin/bash
/usr/bin/chromium-browser --noerordialogs --disable-session-crashed-bubble --disable-infobars --kiosk http://www.google.com
exit 0
我可以手动运行该脚本和它的作品完美。 我读了很多种启动时运行这个脚本的方法。 我试过了: 将此行@reboot path/to/my/script
加到crontab -e
文件中没有成功。
此外,我曾尝试加入这一行编辑/etc/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"
/home/pi/Desktop/script1.sh& <-------- THIS LINE
fi
exit 0
我已经检查脚本是可执行和rc.local中太:
- rwxrwxrwx 1个屁屁SCRIPT1。 SH
- rwxr-XR-X 1根根rc.local中
我可以看到SCRIPT1。在我的任务管理器(它以root身份运行)上运行tesk,但没有发生任何事情。
默认用户是Pi,我以Pi用户身份登录,而不是root用户,也许这是问题所在? 有人可以解释我是什么问题,为什么我只能在任务管理器中看到脚本?我该怎么办 ? TNX!
UPDATE 我已经改变了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"
su - pi -c "/usr/bin/chromium-browser --noerordialogs --disable-session-crashed-bubble --disable-infobars --kiosk http://www.google.com &"
fi
exit 0
仍然不为我工作:|
在你的rc.local,你似乎缺少命令名和'&'之间的空格。除此之外,它看起来像你有正确的想法。你可以试试'printf'运行...“; /home/pi/Desktop/script1.sh || printf“FAILED%d”“$?” &'获得更多信息(仔细检查你是否修改了正确的rc.local等) – John
我可以在任务管理器上看到脚本,它也有一个pid,但我无法看到它(浏览器窗口):|也许它适用于背景或其他...任何想法? :| –