Issue
I am currently trying to get a display window I made in html setup to work immediately when the pi is plugged in, without needing to type in command prompt codes everytime it is shutdown
The 3 commands I need are:
cd ~/Desktop/screen
python -m SimpleHTTPServer
chromium-browser --start-fullscreen http://localhost:8000
- The first one directs to the location the files are in (index.html and its supporters)
- The second one starts the server in that location
- The third one launches chrome in f11 mode, filling the entire screen and connected to the default location of SimpleHTTPServer
I have implemented this directly in the terminal and it works, but even just sticking this in a .sh file does not operate, let alone hooking the .sh into the backend. I was following this instructable: https://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/
The thing is only serving static content, and people only will access it with their eyes looking at the screen. (If chrome allowed access to local files, it would literally be opening an html document). I tried setting up a full server, but between me being new to linux, pi, and servers, that did not get far.
Any help getting this set up will be greatly appreciated.
Solution
I got it working. There needs to be an '&' at the end of SimpleHTTPServer
python -m SimpleHTTPServer &
Also, chromium cannot be booted at this point, as the screen has not been initialized by the pi yet (from what I read). Instead, go into chromium's settings and change the startup page to "localhost:8000"
final .sh file
#!/bin/sh
#!launcher.sh
#!navigate to home directory, then to here
#!launch simple python server
#!open chrome at localhost:8000
cd /
cd /home/pi/Desktop/screen
python -m SimpleHTTPServer &
cd /
you will need to open chrome manually, but upon opening, it will be on the correct page.
The rest of the instructions at https://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/ worked
Answered By - Collin