How to shut down daemon started by serve_book(daemon=TRUE)

bookdown

#1

What's the preferred way to kill the daemonized server started by serve_book(daemon=TRUE)?


#2

I am not 100% sure that it is the same, but when I use serve_site from blogdown it gives me a message with the line of code to run to kill the server (which is mostly doing to give you the exact instance number that has to be passed to the function) or it tells me to restart my R session (Ctrl + Shift + F10).. So if this command doesn't give you a message with the correct instance number to kill it than you can always just restart your R session.


#3

Ah I see it now! To stop the server, run servr::daemon_stop("981593464") or restart your R session. Thanks @tbradley. There's also servr::daemon_list() in case you miss the message and don't feel like scrolling up, and you can also use daemon_pid <- serve_book(...) to capture the pid at startup.


#4

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: