Manage terminal with node Powershell : start, interact and stop them - node.js

I'm developping an desktop app with electron, where I need to run dynamically many server in the backend :
My solution is to use node-powershell, to run powershell command in the backend application.
I need to start and stop dynamically terminal and interact with them, push command inner them then get the output in my xterm.js interface.
I found how start and stop it, with Start-Process but I still have no ideas how intrect with thoses, once there are running

Related

How to block the messages on cmd from the running app on windows python

everyone.
I made a script to run the apps on windows automatically as well as to check the status of authentication using python.
While running the script, there are some messages from the apps, not from my python script.
I want to remove or block these messages from the apps if possible.
Thanks.

how can I run gatsby serve as a service in centos?

or is there a third framework to deploy it? Now I use gatsby serve to run it in centos, but the server shuts down after I exit console window.
Generally for this sort of thing there are a few ways to do it, among which are:
the simplest one is appending an & after the command and running disown before exiting your terminal session, & makes it so that the process runs in the background and disown separates the process from it's parent so that it doesn't close when you exit. If you use this method I would recommend forwarding the output of the command to a file so that you can later review it after your session has closed, for example gatsby serve & > access.log
a better solution is using programs such as screen or tmux which create a terminal session that can be "closed" and reopened after, please take a look at the linked man page, or run man screen (or man tmux) on your system to see how to use them as this is beyond the scope of this question.
The best solution however is however something integrated in gatsby: the build command. This generates a standalone node.js application that can be deployed on a remote server, you would build your application and setup a server such as nginx for this

node.js forever arguments for background

I am trying to run my node.js app using forever on windows 64 bit.
I have tried the followed, i installed foreman from npm . App is started with foreman start app.js. I observe that the node is running with my account.
When logged out of the box the process stops. Is there away to start foreman and node to run with a system account so that its always running with out associating node to a specific user.
Any help would be greatly appreciated. TIA
You would need to run your app or forman either as a service or a scheduled task triggered to run at startup.
I found this package that will replace forever and install pm2 as a service.
https://www.npmjs.com/package/pm2-windows-service
Using forever:
There is at least this Stackoverflow question covering creating a service and probably others.
Question about creating a service from an exe
Creating a scheduled task tutorial
Open Task scheduler:
Use windows search or control panel/administrative tools/Task Scheduler
You can also open a cmd console and copy %windir%\system32\taskschd.msc /s into it and hit enter.
From there you can create a new task, set a schedule that triggers on startup, point it to forever and set it to run if your logged in or not.
The link above, or other google results, will give you good tutorial info to work through it step by step.

Pass Node.js commands while running the file

I'm building a small application that will be running 24/7. I need to be able to give the app Node.js's commands from the console.
Currently, if i want to give an additional command to the app i have to edit it's files, kill it then start it again. I want to start it once and be able to run commands from the console.

How to make Team City release the exe once node starts

I am trying to get a node.js application working on a CI server (Team City). I have a build step which goes like this...
npm start "path/to/my/app"
And it works however the build step hangs because the console will not shut down (it can't because it needs to stay open to run the server). So what can I do to get Team City to kick off the command line without staying open?
You are facing a more general problem of running node.js as a background service (the one that does not hold the console etc.)
Common solution to this is to use Forever CLI tool

Resources