Go-ipfs: ipfs daemon shutdown command

Created on 3 Aug 2016  路  4Comments  路  Source: ipfs/go-ipfs

It would be useful to have a command to be able to halt the daemon programmatically, either ipfs daemon stop or ipfs daemon shutdown.

Related Issues:

dihard help wanted kinenhancement topidaemon + init

Most helpful comment

we have this now. ipfs shutdown

All 4 comments

we have this now. ipfs shutdown

This is not an issue, but more of a query. I am sorry if this is not the right forum for it but as its specific to this command I was hoping to get some help here.

I am working on something where I programatically start the ipfs node. I was trying to understand the shutdown code.

    Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {

    nd, err := cmdenv.GetNode(env)
    if err != nil {
        return err
    }

    if !nd.IsDaemon {
        return cmds.Errorf(cmds.ErrClient, "daemon not running")
    }

    if err := nd.Close(); err != nil {
        log.Error("error while shutting down ipfs daemon:", err)
    }

    return nil
},

The ipfs daemon is running in a separate process. How is this able to stop the same running node? Is there some way this cmdenv is able to share memory between processes?

I might have to go much deeper in code to understand this, so if anyone knows it on the top of their head I would really appreciate it!

I'd be happy to answer this question on https://discuss.ipfs.io.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

whyrusleeping picture whyrusleeping  路  4Comments

0x6431346e picture 0x6431346e  路  3Comments

ArcticLampyrid picture ArcticLampyrid  路  3Comments

funkyfuture picture funkyfuture  路  3Comments

magik6k picture magik6k  路  3Comments