I made a bash script to open a certain webpage after my Pi 2 has booted. To do so, I use Bash to read a file on my system containing an ID, and append it to an existing URL. This full URL then gets opened in a kiosk mode. The idea is that I can easily clone my SD card and only change 1 file to show a different page on different PIs, instead of changing it in the bash script.
When I run this script from the terminal, everything works fine. The file gets read, the url appended, and the right page is shown. However when it gets run from boot, the browser gets opened but the url without the appended ID gets shown.
What might cause the script from not reading the file on boot, but reading it fine from the terminal?
The script basically looks like this:
#!/bin/bash
PICONTENT=$(<pi_id) #my file with the id
echo "The id is $PICONTENT"
URL="myurl.com/$PICONTENT"
kweb $URL
exit
pi_id
is an absolute path...pi_id
was actually a relative path. I made sure to change it to an absolute path now. I'll test this out and report back.