In order to track the activity of our users (Jupyterhub on Kubernetes), we’d like to report the start and end (manually or due to cull settings) of sessions.
Are there any recommended mechanisms for attaching python or bash code to these events?
I considered writing two custom scripts and moving them to “/etc/rc3.d” and “/etc/rc0.d” to run at startup and shutdown, respectively. But I’m unsure if that’s the best option we have for Jupyterhub.
Kindly share any solutions you know useful for such features.
Edit: it seems possible to add “lifecycleHooks”, among which I saw an example of “postStart”. Is there also a “preStop” callback? If that’s the case then that should be what I need.