# STOPING elasticsearch.bat -NODE JS

**URL:** <https://discuss.elastic.co/t/stoping-elasticsearch-bat-node-js/195589>\
**Category:** Elasticsearch\
**Created:** [August 17, 2019, 8:48am UTC](https://discuss.elastic.co/t/stoping-elasticsearch-bat-node-js/195589 "2019-08-17T08:48:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aiswarya](https://avatars.discourse-cdn.com/v4/letter/a/df788c/32.png) [@aiswarya](https://discuss.elastic.co/u/aiswarya)\
**Post date:** [August 17, 2019, 8:48am UTC](https://discuss.elastic.co/t/stoping-elasticsearch-bat-node-js/195589/1 "2019-08-17T08:48:28Z")

</div>

i'm using node js child\_process module to run the elasticsearch.bat as follows  
start:async()=\>{

> const { spawn } = require('child\_process');  
> var bat = require.resolve('C:/elasticsearch-7.0.1/bin/elasticsearch.bat');  
> var run = require.resolve('main.bat');  
> var ls = spawn(bat,{run});  
> ls.stdout.on('data', function (data) {  
> console.log('stdout: ' + data);  
> });  
> ls.stderr.on('data', function (data) {  
> console.log('stderr: ' + data);  
> });  
> ls.on('close', (code) =\> {  
> console.log(`child process close all stdio with code ${code}`);  
> });  
> ls.on('exit', function (code) {  
> console.log('child process exited with code ' + code);  
> });  
> },  
> i wrote this code inside elasticsearch.js file

after the run i'm doing some other tasks ..at end of all i need to close the terminal ...what is the way to do that ..i used "SIGINT" "SIGTERM" ..but not worked

flow of execution:  
1.running main.bat  
2.which will call main.js  
3.from main.js calling the start() method of elasticsearch.js

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 14, 2019, 8:48am UTC](https://discuss.elastic.co/t/stoping-elasticsearch-bat-node-js/195589/2 "2019-09-14T08:48:41Z")

</div>

Closed on September 14, 2019, 8:48am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
