Skip to content

Instantly share code, notes, and snippets.

@theone4ever
Last active February 3, 2019 15:14
Show Gist options
  • Select an option

  • Save theone4ever/230dff45a01a8ecc7dd331f84d3cafc9 to your computer and use it in GitHub Desktop.

Select an option

Save theone4ever/230dff45a01a8ecc7dd331f84d3cafc9 to your computer and use it in GitHub Desktop.
[Unit]
Description=Jupyter Notebook
[Service]
Type=simple
PIDFile=/run/jupyter.pid
# Step 1 and Step 2 details are here..
# ------------------------------------
#Note: `workon tf` is to switch to tf virtualenv where i have jupyter installed
ExecStart=/bin/bash -c 'cd /home/keven/notebooks && source /home/keven/.profile && workon tf && jupyter notebook'
User=keven
Group=keven
WorkingDirectory=/home/keven/notebooks
Restart=always
RestartSec=10
#KillMode=mixed
[Install]
WantedBy=multi-user.target
@theone4ever
Copy link
Author

theone4ever commented Feb 3, 2019

Create this file under
/usr/lib/systemd/system/jupyter.service

Then execute
sudo systemctl enable jupyter.service

Reload the systemd daemona and restart the service

sudo systemctl daemon-reload
sudo systemctl restart jupyter.service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment