When you start up the jupyter notebook it writes some files describing its state. On Fedora, they end up in in /run/user/<UID>/jupyter. There's a file there nbserver-<PID>.json. In the file you'll find some basic data about the server, including the "pid", which also appears in the filename.
executing kill -2 <pid> twice in quick succession has the same result as pressing ctrl-C twice at the terminal where the server is running, so that shuts down the notebook cleanly. Obviously there can be multiple notebook servers running, even under the same UID, so there can be multiple files there. You'll have to have a way to pick the right one. On Monday, April 16, 2018 at 11:34:41 PM UTC-7, Tevian Dray wrote: > > I'm a relatively new Sage user, trying Jupyter for the first time. OS is > Ubuntu 14.04; Sage version is 8.1. Starting Jupyter from the command line > (sage -n jupyter) works as expected, but so far as I can tell the only way > to shut down the notebook server after closing the browser is via ctrl-c. > What if sage is not started from a terminal? Or if stdout is redirected > to a file? For example, if I redirect stdout when starting sage, then send > ctrl-c after closing the browser, the sage-notebook process continues to > run -- presumably because I have no way to send a second ctrl-c. > > I found this 10-year-old post asking essentially the same question: > > https://groups.google.com/forum/#!newtopic/sage-support/sage-support/IrA6obQupKw > but parts of it are clearly out of date. However, the suggestion to use > "kill -2" sounds promising, but on which process? I only see two, one > running sage-notebook, the other running sage-cleaner. Or is there some > other way? "killall python" works, but presumably isn't a clean shutdown > -- and I certainly wouldn't want to script such a sledgehammer. > > It would be really nice if there were a provided script for shutting down > the notebook server cleanly! > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.