| 1 | #!/usr/bin/env bash |
| 2 | # start.sh — used as the systemd service ExecStart. |
| 3 | # Pulls latest code, installs dependencies, then replaces this shell with |
| 4 | # the Node process so systemd tracks the correct PID and restart works. |
| 5 | |
| 6 | set -euo pipefail |
| 7 | |
| 8 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 9 | cd "$SCRIPT_DIR" |
| 10 | |
| 11 | echo "Clearing old database lock if needed" |
| 12 | rm -rf filemanager.db.lock |
| 13 | |
| 14 | echo "[start.sh] git reset --hard" |
| 15 | git reset --hard |
| 16 | |
| 17 | echo "[start.sh] git pull" |
| 18 | git pull |
| 19 | |
| 20 | echo "[start.sh] npm install --omit=dev" |
| 21 | npm install --omit=dev |
| 22 | |
| 23 | echo "[start.sh] starting server" |
| 24 | exec node server/index.js |