Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restarting rails server, detached rails server

How do you restart the rails server? I started it with

rails server -d

So the server is detached

The only way i know is to do ps aux | grep rails and kill -9 on the process # But is it good to kill processes like this?

Is there any command in rails that is supposed to be used for stopping or restarting the server?

Thanks!

like image 966
pinkroads Avatar asked Nov 26 '25 19:11

pinkroads


1 Answers

Killing the detached server should have no negative consequences (given that there is nobody trying to reach the server). If there is still data that was not persisted however (e.g. from Active Directory caches) you would lose that, of course. If you encounter that problem more often, you may want to think about creating a rake task that will stop the server for you. As an alternative to

ps aux | grep ...

you could also use

lsof -i :[port]

where [port] is the port on which the server is running (default: 3000)

like image 131
C. Müller Avatar answered Nov 28 '25 13:11

C. Müller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!