This seems to work for some users, but not others. The before.sh scripts are the exact same - they are supposed to write to config.py - but the resulting files are different. It would seem that HOME is somehow not defined for one user, but it is hard to tell why. They can run regular batch jobs just fine, and those jobs can see $HOME.
Both output files (with some redaction):
root@ood04:/h/userone/ondemand/data/sys/dashboard/batch_connect/sys/jupyter-22/form/output/0b907c78-9c6d-4d92-bd68-df0f22d68e03# cat config.py
c.JupyterApp.config_file_name = ‘ondemand_config’
c.NotebookApp.ip = ‘’
c.NotebookApp.port = 33039
c.NotebookApp.port_retries = 0
c.NotebookApp.password = u’sha1:blah:blah’
c.NotebookApp.base_url = ‘/node/gpu002/33039/’
c.NotebookApp.open_browser = False
c.NotebookApp.allow_origin = '’
c.NotebookApp.notebook_dir = ‘/h/userone’
c.NotebookApp.disable_check_xsrf = True
c.NotebookApp.nbserver_extensions = {“jupyterlmod”: True}
root@ood04:/h/userone/ondemand/data/sys/dashboard/batch_connect/sys/jupyter-22/form/output/0b907c78-9c6d-4d92-bd68-df0f22d68e03# cd -
/h/usertwo/ondemand/data/sys/dashboard/batch_connect/sys/jupyter-22/form/output/edeaf236-2093-4539-a0f0-59a6f20f2070
root@ood04:/h/usertwo/ondemand/data/sys/dashboard/batch_connect/sys/jupyter-22/form/output/edeaf236-2093-4539-a0f0-59a6f20f2070# cat config.py
c.JupyterApp.config_file_name = ‘ondemand_config’
c.NotebookApp.ip = ‘’
c.NotebookApp.port = 11341
c.NotebookApp.port_retries = 0
c.NotebookApp.password = u’sha1:blah:blah’
c.NotebookApp.base_url = ‘/node/gpu002/11341/’
c.NotebookApp.open_browser = False
c.NotebookApp.allow_origin = '’
c.NotebookApp.notebook_dir = ‘’
c.NotebookApp.disable_check_xsrf = True
c.NotebookApp.nbserver_extensions = {“jupyterlmod”: True}