J
J
Jedi2018-10-12 04:50:44
linux
Jedi, 2018-10-12 04:50:44

How to run sh files on server using nodejs?

Good morning!
I wrote an application in Koa.js...
Now I need some sh file to be launched when a certain method is called. It is possible that the file will need access rights (sudo) and accept parameters that my application will pass.
Explain, please, how to implement it correctly, taking into account security.
Thank you very much in advance!)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Korobkov, 2018-10-12
@PHPjedi

child_process

L
link7, 2018-10-12
@link7

It is not a recommended practice to call a script from a node. While this script is running, the entire main thread will be locked.
But even if ... then here is
https://www.npmjs.com/package/node-ssh

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question