我在运行后台的服务器上运行gulp
gulp &
但有时失败了。所以mi问题是:是否有一些命令让gulp询问是否正在运行。像
这样的东西gulp status
由于
答案 0 :(得分:0)
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