I want some hook command to be executed when new user first come to jupyterhub, e.g. copying .condarc template to user’s home dir.
How to achieve it in jupyterhub on k8s.
great thanks.
There are a few ways, see
1 Like
in my opinion, the postStart
hook will be triggered every time the user pod starts. I am not sure if I understand it correctly.
If that’s true, the .condarc
file will be copied and overwrite the one in HOME directory every time user login which is not the behavior I expect.
I want the copy occurs only once when new user login, i.e. when jupyterhub allocate a new pv for the new user and then copy .condarc
to the new pv’s home dir.
You could check whether the file exists before copying it, e.g.
sh -c 'if [ ! -f /path/to/.condarc ]; then <copy file>; fi'
If you’ve got a more complicated command or logic you can instead include that script in your image, and simply call that script in postStart
1 Like
great thanks for your help!