[Solved] How to stop autoboot python script?

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
annlee
Posts: 11
Joined: Wed Nov 28, 2018 4:19 pm

[Solved] How to stop autoboot python script?

Post by annlee »

hi there, I used the dietpi-config option to run at start-up a python script that shows in screen data perpetually

the problem is I cant even stop it with Ctlr+C or any others, I may need to modify files to work normaly

how can I do it (not very painful solution like editing the sd card files with external linux, I hope)

Thanks in advance :cry: :o
annlee
Posts: 11
Joined: Wed Nov 28, 2018 4:19 pm

Re: How to stop autoboot python script?

Post by annlee »

can anyone help? I can send some paypal donation for the support received :cry:

I guess the only solution is inserting the dietpi microsd in another linux pc and then access the file
/var/lib/dietpi/dietpi-autostart/custom.sh
and remove the line with the python script? and how to do it properly next time?
User avatar
MichaIng
Site Admin
Posts: 2421
Joined: Sat Nov 18, 2017 6:21 pm

Re: How to stop autoboot python script?

Post by MichaIng »

Did you open the issue as well on GitHub: https://github.com/Fourdee/DietPi/issues/2300 ? Please check my answer there.
Copy&Paste from there:
Okay, just read the issue on the forum (I guess this is yours as well?): viewtopic.php?f=11&t=5285

I understood now that it is not only a question but urgent help request 😉.
If you added the script to autostart via `dietpi-config`, then it must be `dietpi-autostart`, which starts the script via systemd unit prior/regardless of login.

To stop it: `systemctl stop dietpi-autostart_custom` 😄
Generally you can use `htop` to kill (background) processes as well. The above is the "soft" way for systemd services.
About "how to do properly next time":
- If the service is meant to run until it is manually stopped, and it should start on boot, prior or regardless of login, there is not "better" way. Just note that you can use `systemctl start|stop|restart dietpi-autostart_custom` to handle it, same as all other systemd services. Systemd units run non-interactively in background, so they are not attached to the terminal and you cannot interrupt then e.g. via ctrl+c.
- Otherwise, if you e.g. want a script to start at login, use `/etc/profile.d/my_script.sh`, which will then start interactively (in foreground) on terminal, thus can be interrupted.
- You can also add some conditional exit path for your script code, but depends on what it does and how 😉.
annlee
Posts: 11
Joined: Wed Nov 28, 2018 4:19 pm

Re: How to stop autoboot python script?

Post by annlee »

thanks a lot, minutes before your reply I found an old email exachanged with Daniel in which we fixed this issue before

basically we type the root and pass and then between all the mess of text it took the string:

Code: Select all

killall python
then it is back to normality :)

now the big problem is how to set up the wifi of rpi3 B, so I will start a new thread :)
Post Reply