Is there an alternative to Ctrl + C to stop the rails server?
My keyboard had an accident and now some key and key combinations will not work. I am using bash shell to issue commands. I've seen that using Ctrl-Pause / Break can stop the server for a couple of messages like this , but my keyboard shows up so that Fn + right-shift to pause and Ctrl + Fn + right-shift to break As detailed on the forum HP Home support . It didn't work for me as it could be how my keyboard is displayed or that this is just another thing from the keyboard won't now. Is there any other way I can stop the server?
Edit: I'm using an external keyboard now. although I am trying to use my laptop built into the keyboard.
source to share
You can find the rails process using the command ps
like this:
➜ ps aux
You see a list of everything that is running on your system. Find the line showing your Rails application.
For example, I am using "Passenger" to launch my application, my application name is "demo" and my process string is:
me 30704 0.0 2.0 705696 155300 ? Sl 18:58 0:01 Passenger RackApp: demo
The process line shows you two elements that you might need:
-
The second element is the process ID number, also known as the PID.
-
The final text is the name of the running application and its arguments.
Kill the process by sending an INT signal to the PID:
➜ kill -s INT 30704
Signals you might want:
-
INT
stands for "program interrupt" and is sent when the user types an INTR character (usually Cc). -
TERM
is a common polite way to ask the program to terminate. -
KILL
causes the immediate termination of the program. It cannot be processed, ignored, or blocked.
If you need to do this more than once, then there are shortcuts.
To find a processing line, you can use grep
or similar tools such as pgrep
or pidof
.
➜ ps aux | grep Passenger
To find the process id number you can use awk
to print the second line item:
➜ ps aux | grep Passenger | awk '{print $2}'
To kill all processes with a specific pattern in the name or arguments, you can use pkill
:
➜ pkill -f Passenger
source to share