Created
January 22, 2016 15:04
-
-
Save osteele/564d5374dc8657170a8b to your computer and use it in GitHub Desktop.
install-jupyter-launchagent.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
die() { echo "$@" 1>&2 ; exit 1; } | |
LAUNCH_AGENTS_DIR=~/Library/LaunchAgents | |
[[ -d $LAUNCH_AGENTS_DIR ]] || die "Missing directory: $LAUNCH_AGENTS_DIR. Are you sure you're on a Mac?" | |
NOTEBOOK_DIR=~/code/notebooks | |
[[ -d $NOTEBOOK_DIR ]] || die "Missing directory: $NOTEBOOK_DIR" | |
cat > $LAUNCH_AGENTS_DIR/org.jupyter.notebook.plist <<EOT | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>KeepAlive</key> | |
<true/> | |
<key>Label</key> | |
<string>org.jupyter.notebook</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/bin/jupyter-notebook</string> | |
<string>--no-browser</string> | |
<string>--port</string> | |
<string>8888</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>WorkingDirectory</key> | |
<string>$NOTEBOOK_DIR</string> | |
<key>StandardErrorPath</key> | |
<string>/usr/local/var/log/jupyter-errors.log</string> | |
<key>StandardOutPath</key> | |
<string>/usr/local/var/log/jupyter.log</string> | |
<key>KeepAlive</key> | |
<true/> | |
</dict> | |
</plist> | |
EOT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment