I am trying to use the FileContentsManager.pre_save_hook and FileContentsManager.post_save_hook.
I have followed the example here: File save hooks — Jupyter Server documentation , putting the code into the /etc/jupyter_server_config.py. That did not seem to be getting called, so I put it in a separate file: /opt//opt/tljh/config/jupyterhub_config.d/file_save_configuration.py. I know the file is being read, because if I put a syntax error into the file, it will show up as an exception in the jupyterhub log. However, when I save a file, the hooks do not appear to be called. Should this work in TLJH?
It should work if you put it in /etc/jupyter/jupyter_server_config.py (the path you pasted was missing the /jupyter/ part). This file needs to be found by the Jupyter Server, not JupyterHub.
Thank you for clarifying that. I tried again putting code into jupyter_server_config.py, and this time it worked. It wrote to the log file, and created a text file in a shared directory.
In case this helps anyone else, here is what I did that worked:
added the following code to /etc/jupyter/jupyter_server_config.py
killed any existing running servers: pkill jupyter+