Skip to content

Detect if ipfs daemon is already running. #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
paulogr opened this issue Nov 19, 2017 · 4 comments
Closed

Detect if ipfs daemon is already running. #175

paulogr opened this issue Nov 19, 2017 · 4 comments
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature P2 Medium: Good to have, but can wait until someone steps up

Comments

@paulogr
Copy link

paulogr commented Nov 19, 2017

Is there a way to detect if the ipfs daemon is already running?

thanks!

@dryajov
Copy link
Member

dryajov commented Nov 19, 2017

It depends

  • If using the .disposable method, it will only give you a node which has to be explicitly started/stopped - you'll have to start it yourself with ipfs.startNode()
  • if using .disposableApi method you'll get the node started and an instance of ipfs-api connected to that node

Both of this methods take an explicit repo path, if an instance is already running using that repo, the new daemon will fail acquiring the repo lock - this should be a good indicative of whether there is a daemon running or not.

What is your particular use case?

@paulogr
Copy link
Author

paulogr commented Nov 20, 2017

Thank you for your answer!

I'm using the .local method and, to tell the truthy I'm still have difficult to understand the difference between those three methods.

So far I understand the .local method I get an ipfs node and start it myself like you sad it works with .disposable method. But I don't want the repo gets removed after I stop the service.

I'm building a node js app, and getting problems to catch this error because it doesn't have a code or any indicative that was caused by an already running deamon. There is no way to distinguish this error from another critical error.

Do you know what I mean?

@daviddias
Copy link
Member

ref: #182

@daviddias daviddias added status/ready Ready to be worked kind/enhancement A net-new feature or improvement to an existing feature help wanted Seeking public contribution on this issue exp/expert Having worked on the specific codebase is important P2 Medium: Good to have, but can wait until someone steps up labels Jan 25, 2018
@dryajov
Copy link
Member

dryajov commented Mar 29, 2018

This has been addressed in #221

@dryajov dryajov closed this as completed Mar 29, 2018
@ghost ghost removed the status/ready Ready to be worked label Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature P2 Medium: Good to have, but can wait until someone steps up
Projects
None yet
Development

No branches or pull requests

3 participants