1

I have done up a real time GPS python program with raspberry pi3b+ and Adafruit GPS module, the program can run manually when connected to monitor. I would like to auto run it once the raspberry pi connected to power(without monitor). Tried using crontab, init, rc local. But none is working and show an error "import pynmea2 module error" how can I resolve this issue? Thank you so much in advance!

1 Answer 1

1

I assume that you are using Raspbian so you should use a systemd Unit file to start the program. Because you can run it manual from the command line you are also able to run it with a Unit file. You can set the same conditions than running from a command line. Start with this simple Unit file. Create it with:

rpi ~$ sudo systemctl edit --force --full my.service

In the empty editor insert these statements, save them and quit the editor:

[Unit]
Description=My program
After=multi-user.target

[Service]
ExecStart=/full/path/to/myprogram

[Install]
WantedBy=multi-user.target

Enable the new service and check it after reboot with:

rpi ~$ sudo systemctl enable my.service
rpi ~$ systemctl status my.service

Because this is a very simple example it probably will not run on the first attempt. If so you have to tell us more about your program and the conditions it needs to run.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.