Auto-Started Script Process Not Killed on Log-out, Duplicates on Log-in

I’m running UB 22.04. I added my Bash script to be auto-started via the “Budgie Desktop Settings” / “Autostart” GUI and it mostly runs fine (for some reason, two script processes are started instead of the expected one). The main problem is, if I log out of the desktop and log back in, the script gets re-run so that the number of processes now running is doubled. Should my script be auto-started by some other means, such as is described in the article linked here?

Incidentally, the script is running netcat, listening on a port… TIA

Hi @Underdog!

Among the methods described in the related article, I’d rather try to create a crontab which will run your script on startup.
Let me reiterate.

First activate the cron service:

sudo systemctl enable cron.service

Then type crontab -e and select the Nano editor.

Enter the following line:

@reboot /complete/path/to/script.sh

To run your script 30 seconds after booting, enter this one:

@reboot sleep 30 && /complete/path/to/script.sh

Add a line break at the end of the line.

Press ‘CTRL o + Enter’ to save your changes then ‘CTRL x’ to exit.

Reboot, check and come back to tell us if it does what you want it to do better.

Hey, thanks for help jlb!

1 Like