Using an Electron App to control instances of other apps, but sometimes an instance will freeze. It shows up as Not Responding in Activity Monitor, but how can I tell that it's not responding from either Bash or Node.js so I can kill and restart the process? Thanks!
The following answer to a different question might help you:
you could check the files
/proc/[pid]/task/[thread ids]/status
- How to check if a process is in hang state (Linux)
Related
I am running a game server as a service using systemctl to start and stop a script that runs the whole thing. I tried to modify the script to let me use a screen so I could attach to the process that the server is being run on, and issue commands. But so far I've not had much luck. Is it possible to attach to services that are running on a server?
This question belongs on the Unix/Linux StackExchange.
See e.g:
https://unix.stackexchange.com/questions/453998/systemd-connect-to-stdin-stdout-after-service-has-started
If you want to solve it via programming, you could consider writing a small web application as the interface instead of the console.
Not in systemd, but you can start the service using
screen -D -m yourservice
which will create a detached screen session that will wait for the process to exit (so systemd does not see the service terminating immediately if you use this in an ExecStart line). You can then attach to that session normally.
I am deploying my node.js program on a remote machine (Ubuntu 14.04) and the program terminates after ssh session even if I deploy it as background process.
node app.js &
I understand that using forever can solve this, which I have tried and it pretty much works. There is already a thread here that describes the good solutions to it, and there are many other threads all describes good tools and solutions for it.
But, I would like to understand why does the node.js process stops at
first place even if it runs as background process?
Since you are connecting through SSH all the processes belong to that session.
Unless specified by a command like
nohup
or no hang up for short, all the processes that belong to your session through SSH will die with the session.
It's like logging in with a user opening chrome and logging out. The chrome thread will be release once the owner was logged out.
Excuse the noob question but I am having some trouble with a Play Webserver. Currently I start up the app using 'activator run', which as I understand is the dev method of starting this up.
The actual webserver is located on a remote azure cloud VM so I have no gui access and therefore can't leave the activator web interface running to keep the process alive.
The trouble I have is that when my SSH session dies so does the webserver.
I have tried '&' to background the process, and also nohup with no success. In either of those cases the webserver does not even start.
Any advice would be greatly appreciated.
Thanks.
You can use Ctrl+D to exit the play console while keeping the web server process running.
Source: https://www.playframework.com/documentation/2.2.x/Production
Following the AngularJS tutorial on docs.angularjs.org I started the simple webserver I started the web server in web-server.js just to test it, and to try Node for the first time.
I used it for a bit to view a few files and directories and then I wanted to stop it. And realised I didn't know how.
Please help, just closing the Terminal window (yes, I have a Mac OS X 10.6.8) and stopping all processes manually just doesn't feel right and I think there should be another way.
While Control+C is used to kill a process with the signal SIGINT, and can be intercepted by a program so it can clean its self up before exiting, or not exit at all.
Source: https://superuser.com/questions/262942/whats-different-between-ctrlz-and-ctrlc-in-unix-command-line
Is there a way to monitor starting/running/ending apps within node.js?
Like "You just started LibreOffice Writer!".
It would be nice if any of you cracks could help me with this.
Edit:
I am searching for something that runs in the background and is triggered whenever I run a random application/script/whatever has a system-wide pid.
forever is a daemon manager for node.js that can do this.
http://thechangelog.com/post/6637623247/forever-node-js-daemon-manager
https://github.com/indexzero/forever
Or if you just want to start a process once and be able to manage it, you can use the builtin ChildProcess.
http://nodejs.org/docs/v0.4.9/api/child_processes.html