Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if process is running (using process name)

Tags:

go

Is there anyway in Go to check if a proces is running by searching by process name? I see ways to do it with PID, however I don't have the PID to search by. Thanks.

like image 457
user387049 Avatar asked Dec 29 '25 10:12

user387049


1 Answers

http://www.faqs.org/faqs/unix-faq/faq/part3/section-10.html, Find PID of a Process by Name without Using popen() or system()

No direct way available. You can use os/exec with pidof or pgrep to do this. Or read into procfs.

like image 110
Anonymous Avatar answered Dec 31 '25 00:12

Anonymous



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!