bash - How to escape commands in Makefile for killing process remotely? -


server_stop:     ssh $(server_username)@$(server_hostname) \         "kill $$(ps aux | grep '[p]ython abc-server' | awk '{print $$2}')" 

this gives

bash: line 0: kill: (60403) - no such process bash: line 1: 60364: command not found 

i believe brackets around p not escaped correctly. how do this?

if know command line, don't need use ps + grep. use instead, pgrep.

server_stop:     ssh $(server_username)@$(server_hostname) \         'kill $$(pgrep -f "[p]ython abc-server")' 

the -f allows pass full command line found.

in order avoid shell evaluation command $$(pgrep -f "[p]ython abc-server"), surround single quotes, evaluation happen in target server.

note: if possible, keep start/stop script inside server, ssh command call script, avoiding current issue.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -