sh 杀死远程Gulp进程在转发端口上运行LiveReload

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 杀死远程Gulp进程在转发端口上运行LiveReload相关的知识,希望对你有一定的参考价值。

# I often run gulp-livereload on a remote server using port forwarding with plink or putty.
# Putty and plink crash somewhat frequently when carrying on this process remotely. 
# This function - executed in a different terminal on remote host cleans up any zombie gulp process and the parent shell -
# as these zombie processes prevent port forwarding from working when trying to restart gulp.

function killGulp {

  # necessary otherwise when piping ps output through grep,
  # output includes grep command to find gulp
  
	p=`mktemp`
	ps alx > $p
	findgulp=($(grep "gulp\s" $p))
	
	# gulp process id
	pid=${findgulp[2]}
	
	# parent bash process id
	ppid=${findgulp[3]}

  kill -s SIGKILL $pid &>/dev/nul
  kill -s SIGKILL $ppid &>/dev/nul

}

killGulp



以上是关于sh 杀死远程Gulp进程在转发端口上运行LiveReload的主要内容,如果未能解决你的问题,请参考以下文章

sh 在端口上杀死进程

sh 杀死端口上的进程

sh 杀死端口8080上正在运行的东西

sh 通过端口杀死进程

运行 mocha 测试后如何杀死 nodemon 进程?

我怎样才能杀死正在使用端口 8080 的任何进程,以便我可以流浪?