Skip to content

Instantly share code, notes, and snippets.

@LiutongZhou
Last active November 18, 2019 17:30
Show Gist options
  • Save LiutongZhou/b06ae9e87aba3a7518e6a16240e7a79f to your computer and use it in GitHub Desktop.
Save LiutongZhou/b06ae9e87aba3a7518e6a16240e7a79f to your computer and use it in GitHub Desktop.
Start Remote Jupyter on Boot
# Add to ~/.bash_aliases
alias port_forward='nohup ssh -N -f -L localhost:8889:localhost:8889 username:password@remote_server_ip'
alias remote_notebook_start='nohup ssh -f username:password@remote_server_ip "cd rne; conda activate env_name; jupyter notebook --no-browser --port=8889"; port_forward'
alias remote_notebook_stop='ssh username:password@remote_server_ip "pkill -u username jupyter"'
# Add this to crontab -e
@reboot cd /home/{username}; source ./.bashrc; ./miniconda3/envs/{env_name}/bin/jupyter-lab >> ./cronrun.log 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment