How to Fix rap2 npm start Service Not Closing

How to Kill rap2 Service Started with npm start

When using npm start to launch rap2, the service cannot be closed normally. This is because it runs as a pm2 background process and needs to be killed manually.

Solution: Kill the rap2 process along with pm2. Here is an example using rap2-delos:

Script (modify the paths and other info as needed):

#!/bin/bash
Id=`ps -ef|grep /home/jxkj/rap2-delos |grep -v grep|grep -v PPID|awk '{ print $2}'`
Id2=`ps -ef|grep /usr/local/bin/http-server |grep -v grep|grep -v PPID|awk '{ print $2}'`
Id3=`ps -ef|grep pm2 |grep -v grep|grep -v PPID|awk '{ print $2}'`
echo "…………………………………………………………………….."
echo "Stop rap2-delos:"
kill -9 $Id $Id2 $Id3
echo "Done"

Leave a Comment

Your email address will not be published.