Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何确定gulp watch是否正在运行_Javascript_Gulp_Gulp Watch - Fatal编程技术网

Javascript 如何确定gulp watch是否正在运行

Javascript 如何确定gulp watch是否正在运行,javascript,gulp,gulp-watch,Javascript,Gulp,Gulp Watch,我在后台运行服务器上的gulp gulp & 但有时它会失败。所以mi的问题是:是否有一些命令让gulp询问是否正在运行。差不多 gulp status 谢谢gulp中没有什么特别的限制运行多个进程或提醒您已经运行的gulp进程 使用常规Unix技术检查进程是否正在运行。使用像supervisord或runit这样的管理器自动重新启动进程 #the program pidof will set the variable $? to either #1 or 0 in bash dep

我在后台运行服务器上的gulp

gulp &
但有时它会失败。所以mi的问题是:是否有一些命令让gulp询问是否正在运行。差不多

gulp status

谢谢

gulp中没有什么特别的限制运行多个进程或提醒您已经运行的gulp进程

使用常规Unix技术检查进程是否正在运行。使用像supervisord或runit这样的管理器自动重新启动进程

#the program pidof will set the variable $? to either
#1 or 0 in bash depending on if it finds a process
#with that name.  It will also print out all the matching
#process IDs to the command line
pidof gulp
echo $?  #1 if there is no process called gulp
         #0 if there is a process called gulp
if pidof gulp; then 
   echo 'gulp is alive';
else
   echo 'we need some support over here!'
   ./node_modules/.bin/gulp watch &
   sleep 3
fi

当它停止时,你是否试图被提醒?当自动停止时,您是否尝试重新启动它?
ps aux | grep gulp
应列出正在运行的gulp进程