Running ngrok in the background
ngrok includes commands to run itself in the background as a native operating system service, that is, as a daemon. When it runs as an operating system service it:- Starts when the machine boots
- Automatically restarts after crashes
- Can be managed via native OS service tooling
- Sends logs to the OS’s native logging service
- Starts all endpoints defined in the configuration file, the equivalent of running
ngrok start --all
In most cases, installing ngrok as a service requires administrator privileges.
Try it out
Create an ngrok configuration file. For this example, assume it’sC:\ngrok\ngrok.yml.
In your configuration file, make sure you include the authtoken property and define all of the endpoints you want to start.
Then run:
ngrok service commands to manage the installed service:
ngrok service startngrok service stopngrok service restartngrok service uninstall
Why is ngrok running in the background?
An administrator or a vendor may have installed ngrok as a service so an integration survives logout and reboot. Check the service’s executable path, account, and arguments to find its owner and config file. If you don’t recognize it, see what to check before you change or remove it.Remote management
You can stop, restart, or upgrade the ngrok agent remotely using the Tunnel Sessions API. You can also perform these actions from the ngrok dashboard. On Windows, the Tunnel Sessionsrestart operation isn’t supported.
If the agent is installed as a Windows service, use the Tunnel Sessions stop operation and rely on your Windows service recovery policy to start the service again after it stops.