I just started using rust for the web and I have run into a problem where once I call trunk serve I do not know how to stop it.
this must sound like the whole unable to quit vim meme...
Use Ctrl+C. Its the standard way to signal a running command-line tool to exit and I don't think trunk serve understands anything else.
If ctrl+c doesn't work (for some unknown reason the terminal was stuck and it didn't work for me), you can list the process running on port 8080 (or whatever port you are using to run the server)
sudo lsof -i:8080
and then kill the process
kill -9 PID
p.s. works on Linux or Mac
Related
I have a nodejs compiled application that I run from a terminal window on my ubuntu vps.Is there a way to run it in the background, meaning i can afford to close my terminal window and it still works. Note this exe prints the messages on the terminal window when its running
tried PM2, it errors out saying "awaiting restart"
tried nohup, it does not error out and shows process has started but exe does not what it shall do, meaning its not working.
if i do ./app , it works but then i can not close the terminal window.
used tmux, loving it so far.
think might use PM2 with tmux where i can.
I'm using grunt to run the MEAN project on Ubuntu, but when I close the putty (I use putty to connect Ubuntu server from my PC), it would close the program too.
My question is how can I keep MEAN running?
Update: nohub grunt & stops after I close putty
There are various node based process managers which can serve your task. My favorite is pm2 (http://pm2.keymetrics.io/)
Package managers allow your program to keep running even in case of hiccups. They can watch your project directories for any changes that you might push to them and restart servers based on those changes.
Other favorite is forever (https://www.npmjs.com/package/forever).
you need to run the command in background and I would also recommend to use nohup so:
nohup grunt &
should do the trick.
https://en.wikipedia.org/wiki/Nohup
NODE_ENV=staging nohup node appStag.js &
You can use the above command to run node server
and you can get the above environment using process.env.NODE_ENV
I found a npm package called forever is a good solution, I use forever to run the program right now; and it works perfect with putty.
I have a project in Meteor that I started in Windows but have now migrated over to OS X. In Windows, I was always able to stop running the project locally simply by using CTRL-C. This doesn't seem to do anything in the terminal in OS X, it just brings up a new command line.
When I type meteor reset, I get the following:
reset: Meteor is running.
This command does not work while Meteor is running your application. Exit the running Meteor development server.
I looked at meteor --help but no luck there. I also saw a post recommending I go into Activity Monitor and shut down any node processes (which didn't help) but there has to be a way to do this directly from the terminal.
I'm stuck and can't reload the app, because I can't shut down the previous one. Thanks.
Use this code to kill the meteor process:
kill `ps ax | grep '[m]eteor' | awk '{print $1}'`
in Webstorm, click the red cross icon on the left side bar to close the terminal session.
I'm connected to a server remotely. Now, I need to run a process, but the condition here is the process shouldn't terminate even though I had turned off my computer.
How to deal with this problem?
Relevant help is heart-fully appreciated..!!
Thanks in Advance..
You have several options:
Run the script using nohup
Run it through screen
Run it using tmux
Use VNC and run the script from within the X session.
I need to write a bat/cmd script that executes a few applications sequentially after I have ran a node.JS socket server. I am doing this using Cygwin. I think the problem is/what I can't get my head around is waiting for Cygwin to login before executing a command.
So is there any way to listen for the login to be complete. Before entering commands to cygwin?
bash --login -i
any pointers will be appreciated.
thanks Jono
http://getgnuwin32.sourceforge.net/
Cygwin is not for such kind of work.
Gnuwin32 is native port of GNU UNIX coreutils and more.
They are native and live in cmd.exe.