raspbian – Operating a program on boot (Pi 4)

I've been making an attempt to get a program to begin mechanically on boot. I've tried utilizing systemd, init.d, rc.native, and cron to execute my bash script with a purpose to invoke a program (e.g. open an occasion of LXTerminal), and nonetheless can’t see it on boot.

systemd: I created a service in /and many others/systemd/system/, following this template:

Description=My service

ExecStart=/usr/bin/python3 -u most important.py
Restart=all the time


I then created my bash script in /and many others/systemd/system and made it executable, earlier than following the directions within the official Raspberry Pi documentation, working the next instructions:

sudo cp myscript.service /and many others/systemd/system/myscript.service
sudo systemctl begin myscript.service
sudo systemctl cease myscript.service
sudo systemctl allow myscript.service

I used to be knowledgeable {that a} symlink was certainly created, however this system didn't run after beginning the service.

init.d: Following this instance, I added one init script underneath /and many others/initd/, made the script executable, and registered the script to be run at startup, with no consequence.

rc.native: Following the official documenation discovered here, I added my bash script to the the rc.native file in /and many others/, with no consequence.

cron: Following the official documentation discovered here, I ran crontab with the -e flag to edit the cron desk:

crontab -e

Then, I added a scheduled job to crontab:

@reboot bash /residence/pi/mybashscript.sh &

Sadly, there was nonetheless no consequence. I'm hoping to make use of any methodology to run a program mechanically on startup on Raspbian Buster. Please reply if in case you have had any expertise with carrying out this, or have bumped into the identical issues. Thanks in your assist!

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *