This question already has an answer here:
- How to get PID of background process? 7 answers
guys. I am new to bash scripting and deploying Go on ubuntu. I run my Go program like this
go build -o myprogram main.go
./myprogram &
But now, instead of uploading files with sftp and manually change everything I wanted to write simple bash script.
The problem is that I firstly need to kill existing process and I don't know how to get PID and kill it.
Maybe I can run my program using something different so I don't have to find PID.
I tried using ps ax | grep myprogram and then kill it, but no luck
</div>