0

I am running Streamlit app from Google Colab Notebook.

Due to some limitations of sending out the URL of Streamlit app to outside, I follow the tutorial of using Ngrok for sending URL via tunnel.

I know that with a single ngrok client session, I can't run more than one tunnel. But in my case, I want to rerun and reconnect my Streamlit app to ngrok again.

So in order to do so, I want to kill the running Ngrok tunnel first.

So please anyone, could you tell me how to kill ngrok from Colab Notebook?

rensothearin
  • 670
  • 1
  • 5
  • 24
  • Is [ngrok.disconnect()](https://pyngrok.readthedocs.io/en/latest/api.html#pyngrok.ngrok.disconnect) or [ngrok.kill()](https://pyngrok.readthedocs.io/en/latest/api.html#pyngrok.ngrok.kill) not working? Both should accomplish this. – alexdlaird Nov 10 '20 at 15:30
  • 1
    It's because when I was googling about how to kill Ngrok from Colab, there's seem no specific answer (from blog or medium) for the question. There're other kind of methods to kill ngrok by using javascript or other way around but not from Colab command itself. So I asked this question here. Now I am trying your method, and it works. Thank you so much. – rensothearin Nov 11 '20 at 05:02

2 Answers2

1

It's likely you have an orphaned Colab. Go to Runtime -> Manage Sessions, and terminate all of them and then try again.

0

You need to find the processes on which ngrok tunnel is running and kill it.

command to find the processes ids

ps -eaf | grep {{port on which ngrok is running}}

This will result in a list of processes that has a text match with the port number. Identify the ngrok tunnel processes and kill those processes running the following command

sudo kill -9 {{process id}}