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.

6 Answers 6

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
0

I know my response is a little bit too late. But I would like to suggest something for those who had encounter the same problems. The following is applicable with monero gui version 18.3.1 monerod. ( I still don't have any idea if it is applicable for other versions...)

Step 1: In the Log Tab under settings of your monero gui, you will see a textbox just type "save" and wait for the confirmation that the blockchain has been saved.

Step 2: After the blockchain has been saved, just type next "stop_daemon" then wait for confirmation. Make sure to check on Task Manager under Processes if monerod isn't running.

After that you could close the monero gui knowing that the blockchain isn't corrupted and saved properly. You might also want to create a backup until the blockchain isn't fully syncronized.

Just copy data.mdb under C:\ProgramData\bitmonero\lmdb If you can not see ProgramData under C: under Organize>Folder and Search Options>View>Check "Show hidden files, folders and drives"...

I hope these would help... Noob!!!

Your Answer

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

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