Skip to content

Instantly share code, notes, and snippets.

@paulochf
Created April 18, 2018 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulochf/64d90ddbfda12fbd693afe5960f70d9e to your computer and use it in GitHub Desktop.
Save paulochf/64d90ddbfda12fbd693afe5960f70d9e to your computer and use it in GitHub Desktop.
Jupyter Notebook as service in Ubuntu
# After Ubuntu 16.04, Systemd becomes the default.
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd
# https://gist.github.com/whophil/5a2eab328d2f8c16bb31c9ceaf23164f
# PUT THIS IN /usr/lib/systemd/system
[Unit]
Description=Jupyter Notebook
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=<path to env>/bin/jupyter-notebook
User=ubuntu
Group=ubuntu
WorkingDirectory=<Jupyter server working directory>
Restart=always
RestartSec=10
Environment=SOME_ENV_VAR=SOME_ENV_VALUE
#KillMode=mixed
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment