Giter VIP home page Giter VIP logo

Comments (22)

huygn avatar huygn commented on July 19, 2024 42

As of version 2.0.24, ngrok http 80 --log=stdout > ngrok.log & did the trick.

from ngrok.

GuillaumeDesforges avatar GuillaumeDesforges commented on July 19, 2024 11

The right command is now

ngrok http 80 --log=stdout > ngrok.log &

from ngrok.

inconshreveable avatar inconshreveable commented on July 19, 2024 8

@jfelchner That's good feedback. I think you can get what you want now with:

ngrok -log=stdout 80 > /dev/null &

Or if you want a log:

ngrok -log=stdout 80 > ngrok.log &

This is a very unintuitive UI. "-log=stdout" really means "disable the terminal UI", which is surprising and not well documented.

I've recently discovered that it's possible for a program to detect whether it's attached to a tty or not and adjust its UI accordingly. I'll probably use that in the next version of ngrok to disable the terminal UI when run under supervisors or in the background, as well as possibly splitting out "do I run the terminal ui" into a separate option (or at least configuration file parameter).

With regard to a daemonization: it seems like if the "&" operator works as you expect it to, that it becomes unnecessary to have a daemon option. Do you disagree?

from ngrok.

rwestergren avatar rwestergren commented on July 19, 2024 2

This worked for me!

ngrok -log=stdout 80 > /dev/null &

from ngrok.

TheGithubJoshua avatar TheGithubJoshua commented on July 19, 2024 2

This is stupid, the ngrok team should really have a --daemon flag, because i'm sshing into my Raspberry Pi to run ngrok, except when I shut the terminal, the agent stops, so now I have to have my laptop running when when I'm using my Raspberry Pi with OMV.

from ngrok.

tosh avatar tosh commented on July 19, 2024 1

Just wanted to let you know that I've run into the same UX issue and a --quiet or similar flag would have been more obvious.

from ngrok.

MarvinXu avatar MarvinXu commented on July 19, 2024 1

it works! now... how can i stop it?

kill -9 "$(pgrep ngrok)"

from ngrok.

inconshreveable avatar inconshreveable commented on July 19, 2024

I thought I'd replied to this. ngrok does let you supply -log=stdout which will turn off the console interface and just display streaming log output over stdout. There is no daemon mode and I don't intend on adding one. I think daemonizing services is almost always better left to a supervising framework like runit/upstart/supervisor/etc.

from ngrok.

patrickheeney avatar patrickheeney commented on July 19, 2024

You did, this was posted before your reply. Thanks for the tip.

from ngrok.

jfelchner avatar jfelchner commented on July 19, 2024

@inconshreveable I'd be fine if this solution actually let you run the thing in the background, but running something like:

ngrok -log="$HOME/ngrok.log" 80 &

doesn't even allow you to background the job. It fails with a:

suspended (tty output)  ngrok -log="$HOME/ngrok.log" 80

If I have a config file, I need zero output from ngrok on what it's doing 99% of the time. The -log should disable the "dashboard" screen on what is connected, for how long and on which interfaces. Either that or there should be a -quiet option which does the equivalent thing.

from ngrok.

jfelchner avatar jfelchner commented on July 19, 2024

@inconshreveable also, I can see where you're coming from regarding "daemonizing", however, you have to consider your tool may be used by those who:

a. cannot understand how those services work (eg, explaining to a non-technical QA person how to set it up)
b. don't need the overhead of a "supervising framework" when all they want to do is run ngrok in the background for a few hours so they can pair with someone

I'm currently trying to work on my shellfiles so they can be used by our developers to abstract away whether they are using localtunnel, ngrok, pagekite, etc. All of the other services offer some sort of "run this thing without any terminal output" except for ngrok. So if I'm to support ngrok, I not only have to know if ngrok is installed, but I also have to check to see which type of "supervising framework" they have installed, figure out whether it's configured to run ngrok, and finally execute the proper command for that framework to start ngrok.

That's a lot of extra work for something that is as simple as "route all output to a log file" and optionally "drop a PID file somewhere".

from ngrok.

jfelchner avatar jfelchner commented on July 19, 2024

@inconshreveable if the & option works and I can get everything logged to a file, then I don't think a -daemon option is necessary.

I'll try out your solution above and get back with you.

Thanks for the reply!

from ngrok.

jfelchner avatar jfelchner commented on July 19, 2024

@rwestergren me too. :)

As soon as Github actually gets a "here is a list of all the issues you're subscribed to", stuff like this won't fall through the cracks.

from ngrok.

mint5auce avatar mint5auce commented on July 19, 2024

'scuse my probably stupidity, but how would I get -log=stdout > /dev/null & to work with ssh forwarding, for example, something like this:

./ngrok -subdomain=foo -authtoken barxyz -proto=tcp 22

I can't figure out where the 'tcp' declaration would go.

from ngrok.

larsfk avatar larsfk commented on July 19, 2024

Someone know how to log -proto=tcp 22 ?

from ngrok.

AndySedano avatar AndySedano commented on July 19, 2024

I was successful using a tunnel for ssh in the config file and running
ngrok -log=stdout > /dev/null start ssh &

my config file looks like this

tunnels:
  ssh:
    remote_port: 50800
    proto:
      tcp: 22

from ngrok.

selfagency avatar selfagency commented on July 19, 2024

When I try ngrok -log=stdout 80 > ~/ngrok.log & with v2.0.19, the output I get is the command instructions as though I entered an invalid parameter.

from ngrok.

dragondgold avatar dragondgold commented on July 19, 2024

@selfagency same issue here, the -log is the problem, how to achieve the same thing with the new version?

from ngrok.

IgorGanapolsky avatar IgorGanapolsky commented on July 19, 2024

@gnhuy91 Doesn't this fill up the log file and cause waste of memory? I mean, does log rotation need to be turned on??

from ngrok.

huygn avatar huygn commented on July 19, 2024

@IgorGanapolsky yea you should bring up your own solution, but anw above command no longer available.

from ngrok.

stas00 avatar stas00 commented on July 19, 2024

This solution no longer works (w/ 2.3.35). Incorrect Usage: flag provided but not defined: -log

from ngrok.

zentyk avatar zentyk commented on July 19, 2024

it works! now... how can i stop it?

from ngrok.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.