At times, you may try accessing your python app or nodejs app and you get an error 503.
Checking on cpanel, you notice that you have reached the processes limit.
Thus, you may need to kill these processes for your app to continue working.
Here are the steps.
1. Login to cpanel.
2. Go to Advanced Section and Locate “Terminal”

NOTE: If you cannot locate this feature, reach out to support and request for terminal to be enabled on your cpanel.
3. Lists all running processes by typing
ps faux
Output.

To kill All processes associated with Python, type the command below.
kill -9 $(ps faux | grep python | grep -v grep | awk {'print $2'})
To kill All processes associated with Nodejs, type the command below.
kill -9 $(ps faux | grep node | grep -v grep | awk {'print $2'})

When you run the ps faux
again, you will notice that we no longer have the node and python processes running.
Explanation.
This command does the following:
ps faux
: Lists all running processes.grep python
/node
: Filters for processes that include “python” or “node”.grep -v grep
: Excludes thegrep
process itself from the results.awk {'print $2'}
: Extracts the process IDs (PIDs) from the list.kill -9 $(...)
: Forcefully terminates the processes by their PIDs.
You can also create a cronjob on cpanel to do the same for you.
Below is a sample to run every 10 minutes.
*/10 * * * * kill -9 $(ps faux | grep python | grep -v grep | awk {'print $2'})