3 Add the following contents to “start.sh” file.
#!/bin/sh
cd "/home/pi/Freenove_4WD_Smart_Car_Kit_for_Raspberry_Pi/Code/Server"
pwd
sleep 10
sudo python main.py
Press Ctrl + O and then press Enter to save it. Press Ctrl+X to exit.
4 Modify permissions.
sudo chmod 777 start.sh
5 Enter the following command to create a directory.
mkdir ~/.config/autostart/
6 create and open “start.desktop” file
sudo nano .config/autostart/start.desktop
7 Add the following content to “start.desktop” file.
[Desktop Entry]
Type=Application
Name=start
NoDisplay=true
Exec=/home/pi/start.sh
Press Ctrl + O and then press Enter to save it. Press Ctrl+X to exit.
8 Modify permissions.
sudo chmod +x .config/autostart/start.desktop
9 Finally enter the following content to reboot Raspberry Pi.
sudo reboot
Note: To cancel auto start, please delete the files “start.sh” and “start.desktop” created above.