#Kill many Go instances

7 messages · Page 1 of 1 (latest)

frozen jackal
#

I have a program called ./main it runs as a web server by default and you can run multiple instance by doing ./main --port *port number* and I would like to kill all instances of this web server by doing /main --kill but I have zero idea how to proceed

I was thinking it would act similar to NGINX nginx -s quit

hollow locust
#

in unix it would be pkill name no need to write special code inside

frozen jackal
#

pkill main?

hollow locust
#

the name of your binary (directory name)

#

you could also potentially change your code so it takes a list of ports and open all of them from a single process

#

I guess if you are running ./main & then yes, pkill main will kill all of them

frozen jackal
#

Thank you it works