18

I started monerod as a background daemon with the --detach flag.

Suppose I want to restart my computer, how do I gracefully stop the process?

Can I just kill it?

Thanks in advance.

5 Answers 5

16

Run monerod exit. You can also just kill the process but you might lose the last batch of blocks that way.

3
  • 1
    Thanks. I didn't realize it was that easy … I thought it would attempt to start another process, which is not the case. Just tried monerod exit, monerod status, works great.
    – dpzz
    Sep 6, 2016 at 21:53
  • 1
    For completeness: the exit command will save the blockchain and close the daemon gracefully if not running with the --detach flag.
    – well_then
    Oct 25, 2016 at 17:14
  • What is the difference between stop_daemon and exit -- why do the both exist? Aug 27, 2018 at 11:56
4

When you've started monerod with the --rpc-bind-ip option (and --confirm-external-bind), you should also reference that when sending commands, such as exit (or status). For example, the following wouldn't work anymore:

$ monerod exit
Creating the logger system
Error: Couldn't connect to daemon

You'd need to do it like this instead:

$ monerod exit --rpc-bind-ip ….….….…
Creating the logger system
Stop signal sent
1
3

As for Unix signals:

kill -TERM

Seems to also send the correct shutdown for a clean exit.

Tested on monerod 0.10.3.1 on macOS.

0

Bring monerod process that is running in the background into the foreground and then type exit.

1
  • 1
    Only applicable if you'd ^Z'd it, which is not the case in the question.
    – user36303
    May 9, 2017 at 13:31
0

As of version 0.10.3.1, dpzz's answer doesn't appear to work. Specifically, if you start the daemon with --rpc-bind-ip, referencing that in the commands to send to the daemon doesn't successfully locate the daemon.

1
  • 2
    Still works for me: monerod --rpc-bind-ip ….….….… --confirm-external-bind --detach followed by monerod --rpc-bind-ip ….….….… exit. File an issue on GitHub please if the problem persists. Also, you should comment on an answer here, rather than post a comment as an answer.
    – dpzz
    Aug 12, 2017 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.