You are not logged in.
I have decided to make the switch to jupyter lab for my research but I am not a big fan of running it in same browser with all the other tabs open. So I have changed the jupyter config file to launch it as a chrome webapp instead of in my default browser (firefox). I have also written a .desktop file so that I can launch jupyter in gnome without having to open a terminal. However, when I close the application, only chrome quits, and the jupyter notebook keeps running. If I launch the same app again, a new instance of jupyter notebook is created. Is there any way for me to execute a command every time the chrome app quite to also kill the jupyter notebook to avoid this issue?
The other alternative that I can think of is always keep an instance of jupyter notebook open in the background and make chrome open this existing notebook in an app. I would like to not go down this road though, if possible. While a jupyter notebook that's not doing anything is not that resource intensive, it just seems like a very inefficient way to solve a simple problem.
Last edited by pranav-dahiya15 (2020-09-16 11:10:56)
Offline
There is an option to close and shutdown notebook in the web interface.
Offline
You can write a bash wrapper script to do that. here is a hint in bash:
$ cat jupyter_wrapper.sh
#!/bin/bash
trap _cleanup EXIT INT HUP TERM
_cleanup()
{
jupyter-notebook stop
sleep 2
local pid=$(ps --no-header -C jupyter-notebook -o pid=)
[[ -z $pid ]] && return
kill -s SIGKILL $pid
}
jupyter-notebook
$ chmod u=rwx jupyter_wrapper.sh
$ ./jupyter_wrapper.sh &
You may need justify it according your setup. And you may launch it via a .desktop file without the runaway & sign.
Last edited by solskog (2020-09-16 11:33:58)
Offline