Issue
I have a Raspberry Pi 3 - Model B, with Raspbian jessie operation system. Im trying to open "chromium" on startup.
#!/bin/bash
/usr/bin/chromium-browser --noerordialogs --disable-session-crashed-bubble --disable-infobars --kiosk http://www.google.com
exit 0
I can run the script manually and it works perfect.
I read about a lot of various ways to run this script on startup.
I have tried:
adding this line @reboot path/to/my/script
to crontab -e
file with no success.
Also i have tried to edit /etc/rc.local
file by adding this line:
#!/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
I have checked that the script is executable and rc.local too:
- rwxrwxrwx 1 pi pi script1.sh
- rwxr-xr-x 1 root root rc.local
I can see script1.sh tesk on my Task Manger (it runs as root) but nothing happen.
The default user is Pi and i log as a Pi user and not as root, maybe this is the problem? Can someone explain me what is the problom and why i can see the script only in the Task Manager? what should i do ? TNX!
UPDATE i have changed the rc.local to be like:
!/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
still does not work for me :|
Solution
I did a small hack...
I added this line @lxterminal
to the end of this file:
nano .config/lxsession/LXDE-pi/autostart
It will auto-start terminal on boot.
Then I edited $ sudo nano .bashrc
file.
At the end of the file, I added my path to my script.
./home/pi/Desktop/script.sh
It means that:
The terminal will open every time you boot your Raspberry Pi (first command).
Every time that terminal runs, my script will run also (second command)
It does work for me. TNX for the help :)
Answered By - Adi Azarya Answer Checked By - Candace Johnson (WPSolving Volunteer)