Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
404 views
in Technique[技术] by (71.8m points)

ubuntu - Xubuntu start python script at boot - nothing works

I'm trying to run a python script at startup, I tried to add a [Dekstop Entry] file (.desktop) in /etc/autostart but I see the terminal for a flash and then it closes.

I tried to add the python script with "Session and Startup"

I tried the systemctl way but I got every type of errors...

There is someone out there that managed to autostart a pyhton script in Xubuntu?

question from:https://stackoverflow.com/questions/66054745/xubuntu-start-python-script-at-boot-nothing-works

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I solved by doing like so:

  1. Create the folder /home/username/.config/autostart

  2. Right Click on desktop and select "Create Launcher"

  3. Fill the fields, in "Execute" put the command (ex. pyhton3 path/to/file.py), in "Working Directory" put the folder where the file.py is stored (ex. path/to), check "run in terminal"

  4. drag and drop the file you created in the autostart folder created in the beginning


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...