apollo-ng / picoReflow

Turns a Raspberry Pi into a universal, web enabled Reflow Oven Controller
202 stars 118 forks source link

Autostart onBoot is not working! #27

Open FuchsLo opened 4 years ago

FuchsLo commented 4 years ago

I've tried with a lot of ways to make the server run when the pi is starting but nothing is working. I have a raspberry 3 with the Raspbian Buster Lite OS. The system is just for the oven and i exactly follow the commands, the oven is working well but its not starting when i boot the system.

chron0 commented 4 years ago

I suppose Raspbian is using systemd now, so the provided init script wont help much. I've looked thru the forks and so far it seems no one has provided a systemd unit file :) I could write one blind but without the ability to test it wont make much sense and is likely not to work properly the first time.

Have a look at https://github.com/torfsen/python-systemd-tutorial

it shouldnt be too hard, and if it works for you, please send a PR or comment your unit file here and I'll add it into the lib/init folder.

dawskit commented 3 years ago

I've done startup code by systemd service. You need to do below steps:

  1. create a file picoReflow.service in /etc/sysemd/system by command $ sudo nano picoReflow.service

if your username is pi and picoReflow is installed in location /home/pi/picoReflow you don't need to make any changes in code below.

put in file code:

[Unit]
#Human redable name of the unit
Description=picoReflow Service

[Service]
#Command to execute when the service is started
ExecStart=/usr/bin/python /home/pi/picoReflow/picoreflowd.py

[install]
WantedBy=default.target
  1. $ sudo chown root:root picoReflow.service
  2. $ sudo chmod 664 picoReflow.service
  3. $ sudo systemctl enable /etc/systemd/system/picoReflow.service
  4. sudo systemctl daemon-reload
  5. test if script is working by typing $ sudo systemctl | grep picoReflow.service

You should get answer: $ picoreflow.service loaded active running picoReflow Service

after reebot script should start automaticaly. Tested on RPI zero

chron0 commented 3 years ago

<3 - thx for sharing

f1ssf commented 5 months ago

Hi dawstik, I try your solace, but I have this message: .pi@raspberrypi:~/picoReflow $ sudo systemctl enable /etc/systemd/system/picoReflow.service The unit files have no installation config (WantedBy=, RequiredBy=, Also=, Alias= settings in the [Install] section, and DefaultInstance= for template units). This means they are not meant to be enabled using systemctl. Can you help me please? Many thank's regards

f1ssf commented 4 months ago

it is ok now, I use command diretly on rc.local. thank's