0

I want to run a python script file auto on startup. I am following this post and it worked perfect for desktop ubuntu but when I tried it in orangePI linux no method is working.

I tried

Method 1

Create file ~/.config/autostart/MyScript.desktop with

[Desktop Entry]
Encoding=UTF-8
Name=MyScript
Comment=MyScript
Icon=gnome-info
Exec=python /home/your_path/script.py
Terminal=false
Type=Application
Categories=

X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Delay=0

Method 2

and also this one

sudo cp -i ~/Desktop/test_code.py /bin

sudo crontab -e

Add the following line and save it:

@reboot python /bin/test_code.py &

Any one can guide me?

Imran
  • 719
  • 4
  • 16
  • Your first attempt would run a file when you log in to the GUI, not at startup. Your second attempt would nominally work; probably something in your Python script is wrong (such as if it requires a GUI, which isn't available at this stage in the boot process). Voting to close as the generic "how do I troubleshoot `cron` jobs" question; if you can add more details, maybe we can get this reopened. – tripleee Jun 23 '21 at 13:27

0 Answers0