R
R
roskom_nadzor2016-09-04 16:02:30
cmd/bat
roskom_nadzor, 2016-09-04 16:02:30

How to execute a command from another file during node.js execution?

I can’t put it into words correctly, so I’ll briefly describe it in general:
there is an express + scheduler in node.js that works through forever.
There is a certain task that should be executed at the request of the user, at any time.
Of course, you can simply call the script from the console, but for the convenience of the user, I would like to put the shortcut on the desktop. But the problem is that there is no problem writing a batch file, but you need to somehow infiltrate an already running process and execute the command there.
That is, the server is running and you need to execute a certain command during operation, moreover, from the icon from the desktop. How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
roskom_nadzor, 2016-09-05
@roskom_nadzor

Understood. In my case, it’s suitable to write a script in package with something like this
node -e require(./task/blabla.js)()
or
node -e require(./task/blabla.js).funk1()
if you need some specific function.
Then on the desktop you create a batch file that does something like this
cd C:/blabla
npm start-script blabla
simple and effective solution

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question