Run an external program when Brave starts and stop

I run brave on an old linux desktop, and I’d like to stop/renice two external programs that run 24/7 on my PC when brave starts and when brave exits.
How would I achieve this?

create script file that when you run it it close whatever you like then it start brave

you use this script to start brave instead of the normal icon

search for script and the command required to run or close your program

Yea, I was hoping to use the icon