我想运行的脚本只会停止并清除容器。
我已经试过了:
process.on('exit', function(code) {
console.log(`Tearing down containers`);
shell.exec('./stop_ctn.sh')
});
app.listen( app.get( 'port' ), function(){
console.log( 'Express server listening on port ' + app.get( 'port' ));
})
这会引发此错误:
Elasticsearch ERROR: 2021-03-27T16:11:45Z
Error: Request error, retrying
HEAD http://localhost:9700/ => connect ECONNREFUSED 127.0.0.1:9700
在它抛出该错误后,有时我可以访问 elasticsearch 容器,有时则不能。
试图找到一种在节点服务器停止后执行脚本的方法。