Sponser Link

Raspberry pi run python script on startup

There are many ways is available for set any python script on startup. Here most easy method is described.

Steps for Configuration at startup

Create a directory ‘autostart’ in .config. You can create the folder directly or using terminal can create the folder.

    pi@raspberrypi:~ $ mkdir /home/pi/.config/autostart/

Go to in this directory

    pi@raspberrypi:~ $ cd /home/pi/.config/autostart/

Now create a file app.desktop in the above directory with the following content.

    [Desktop Entry]
    Name=Your Application Name
    Comment=Some Comments about your program
    Exec=sudo python3 /home/pi/mu_code/test.py

Allow these step, make file to executable using following command in terminal.

    pi@raspberrypi:~ $ chmod +x /home/pi/.config/autostart/app.desktop

Now restart your pi and it will run your app After desktop is ready.