|
|
@ -0,0 +1,19 @@ |
|
|
|
#!/bin/bash |
|
|
|
|
|
|
|
PORT=3000 |
|
|
|
|
|
|
|
pid_rails=$(ss -tlnp | grep "$PORT" | grep -oP "pid=\K(\d+)" | head -n1) |
|
|
|
if [[ -n $pid_rails ]]; then |
|
|
|
echo "============================================================================" |
|
|
|
echo "Rails already runs on port $PORT, You've asked for debugger on the same port." |
|
|
|
echo "============================================================================" |
|
|
|
echo -n "Do you to want to kill rails process in order to launch debugger: (y/N)?: " |
|
|
|
read -n1 answer |
|
|
|
case $(echo $answer | tr '[A-Z]' '[a-z]') in |
|
|
|
y|yes) kill -15 $pid_rails ;; |
|
|
|
*) echo " means NO"; exit 1 ;; |
|
|
|
esac |
|
|
|
else |
|
|
|
echo "port $PORT is free for debugger, go on..." |
|
|
|
fi |
|
|
|
|