How do I shut the server down in Meteor programmatically?


#1

So I develop my Meteor apps on my Macbook Pro which I use for every day stuff like watching movies, news etc. too

The problem is whenever I finish coding, I always forget to shut down my Meteor instance, and that burns down the battery life.

So I was thinking of creating a task that would when in development environment, wait for half an hour or so, and shut itself down.

So something like this

Meteor.startup(function() {
return Meteor.setInterval(function(){
if(Debugging) {
// shut down server }
}
, 1800000);
});

The only problem is I don’t know what command I could use to shut down the server. Is this possible to do in Meteor?


#2

I don’t think it’s possible from inside meteor no. You’ll have to write an external script that starts meteor and exits after x amount of time.


#3

Ctrl+C shuts down the server.


#4

I would proabably check if there is node way
https://nodejs.org/api/process.html#process_process_kill_pid_signal