Skip to content

03 Setup for Launch

lovebootcaptain edited this page Jun 30, 2020 · 1 revision

setup the services

sadly pygame doesn't like to work well with systemd... so it has to run as init.d service. maybe someone can help to solve this one time.

cd
cd WeatherPi_TFT
sudo cp WeatherPiTFT.sh /etc/init.d/WeatherPiTFT
sudo cp PiButtons.sh /etc/init.d/PiButtons

run python with root privileges

  • this is useful if you like to run your python scripts on boot and with sudo support in python
sudo chown -v root:root /usr/bin/python3
sudo chmod -v u+s /usr/bin/python3

setting up python3 as default interpreter

  • this should start your wanted python version just by typing python in the terminal
  • helps if you have projects in python2 and python3 and don't want to hassle with the python version in your service scripts
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives --install /usr/bin/python python /usr/bin/python3.4 2

you can always swap back to python2 with:

update-alternatives --config python

and choose your preferred version of python

  • check if python3.x is now default with:
python --version
  • it should say something like:
Python 3.7.x
  • if everything is set up and updated correctly:
sudo reboot

test the services

  • for the WeatherPiTFT Service
sudo service WeatherPiTFT start
sudo service WeatherPiTFT stop
sudo service WeatherPiTFT restart
sudo service WeatherPiTFT status
  • for the PiButtons Service
sudo service PiButtons start
sudo service PiButtons stop
sudo service PiButtons restart
sudo service PiButtons status
  • if this is doing what it should you can run the service every time you boot your pi
sudo update-rc.d WeatherPiTFT defaults
sudo update-rc.d PiButtons defaults