I'm new to bash scripting and just a little familiar with basic Linux. We've setup a Pi showing dashboards using the code below:
@chromium-browser --disable-infobars --disable-session-crashed-bubble --kiosk http://www.url.com
which is located in this directory /home/pi/.config/lxsession/LXDE-pi/autostart.
But I'd like to create a solution where the URLs that are opened are more easily maintained. Therefore, I figured I could create a .txt file, which a bash script could read and create the command with all the listed URLs.
This is what I've tried:
In /home/pi/.config/lxsession/LXDE-pi/autostart:
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@point-rpi
@sh ~/startChrome.sh
In /home/pi/startChrome.sh:
#!/bin/bash
input="$HOME/websites.txt"
sites=""
while IFS= read -r var
do
sites=$sites" "$var
done < "$input"
chromium-browser --disable-infobars --disable-session-crashed-bubble --kiosk $sites
Example content of /home/pi/websites.txt:
http://www.google.com
http://www.somewebsite.com
I've tried to test this by running the startChrome.sh file, but this returns an error:
pi@TeamMBA:~ $ sh startChrome.sh
[977:977:0601/113521:ERROR:browser_main_loop.cc(271)] Gtk: cannot open display:
Any suggestions on how to fix this? Or maybe I'm overthinking this and there is an easier way to fix this?