medemi68
medemi68

Reputation: 175

NPM.JS plugin for accessing the linux terminal

Here is my situation. I'm working on an application that uses node.js. However, I cannot find a plugin that will shut down the system without any intervention. I figured that if I can access bash (the command line for linux) I should be able to enter shutdown -h -P now. Ideally, the code would look something like this:

var commander = require('commander'); // Example

commander.command("shutdown -h -P now");

and it would shut down the system. Thanks for reading this, and for your help! If you can find either a module that will shutdown the system, or a module that can access the terminal, that would be appreciated.

Upvotes: 0

Views: 51

Answers (1)

Justin Maat
Justin Maat

Reputation: 1975

I think this is built in native. https://nodejs.org/api/child_process.html.

You can google around for examples.

Also. You can check out the shell.js module

Upvotes: 1

Related Questions