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 > > .