Update start_server.sh
Browse files- start_server.sh +23 -1
start_server.sh
CHANGED
|
@@ -1,8 +1,30 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
|
| 3 |
|
|
|
|
| 4 |
NOTEBOOK_DIR="/data"
|
|
|
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
|
| 7 |
|
| 8 |
jupyter-lab \
|
|
@@ -16,4 +38,4 @@ jupyter-lab \
|
|
| 16 |
--ServerApp.disable_check_xsrf=True \
|
| 17 |
--LabApp.news_url=None \
|
| 18 |
--LabApp.check_for_updates_class="jupyterlab.NeverCheckForUpdate" \
|
| 19 |
-
--notebook-dir=$NOTEBOOK_DIR
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
|
| 3 |
|
| 4 |
+
# Define directories
|
| 5 |
NOTEBOOK_DIR="/data"
|
| 6 |
+
ORIGINAL_NOTEBOOKS="/notebooks"
|
| 7 |
+
BACKUP_DIR="/home/user/original_notebooks"
|
| 8 |
|
| 9 |
+
# Create backup directory if it doesn't exist
|
| 10 |
+
if [ ! -d "$BACKUP_DIR" ]; then
|
| 11 |
+
echo "Creating backup directory for original notebooks..."
|
| 12 |
+
mkdir -p "$BACKUP_DIR"
|
| 13 |
+
# Copy all original notebooks to the backup directory
|
| 14 |
+
cp -r "$ORIGINAL_NOTEBOOKS"/*.ipynb "$BACKUP_DIR"
|
| 15 |
+
fi
|
| 16 |
+
|
| 17 |
+
# Clear the notebook directory and copy fresh notebooks for this session
|
| 18 |
+
echo "Preparing fresh notebooks for this session..."
|
| 19 |
+
mkdir -p "$NOTEBOOK_DIR"
|
| 20 |
+
rm -rf "$NOTEBOOK_DIR"/*.ipynb
|
| 21 |
+
cp "$BACKUP_DIR"/*.ipynb "$NOTEBOOK_DIR"
|
| 22 |
+
|
| 23 |
+
# Set proper permissions
|
| 24 |
+
chmod -R 755 "$NOTEBOOK_DIR"
|
| 25 |
+
|
| 26 |
+
# Start JupyterLab
|
| 27 |
+
echo "Starting JupyterLab..."
|
| 28 |
jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
|
| 29 |
|
| 30 |
jupyter-lab \
|
|
|
|
| 38 |
--ServerApp.disable_check_xsrf=True \
|
| 39 |
--LabApp.news_url=None \
|
| 40 |
--LabApp.check_for_updates_class="jupyterlab.NeverCheckForUpdate" \
|
| 41 |
+
--notebook-dir=$NOTEBOOK_DIR
|