Spaces:
Running
Running
| # | |
| # Install (or upgrade) the MethdAI Receptionist systemd unit on the robot. | |
| # Run on the robot itself (e.g. via ssh pollen@reachy-mini.local). | |
| # | |
| # Idempotent: re-running picks up edits to reachy-receptionist.service and | |
| # restarts the live service. | |
| # | |
| # After install, useful commands: | |
| # systemctl status reachy-receptionist | |
| # journalctl -u reachy-receptionist -f | |
| # sudo systemctl restart reachy-receptionist | |
| # sudo systemctl disable --now reachy-receptionist | |
| # | |
| set -euo pipefail | |
| UNIT_NAME="reachy-receptionist.service" | |
| HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| SRC="$HERE/$UNIT_NAME" | |
| DST="/etc/systemd/system/$UNIT_NAME" | |
| if [[ ! -f "$SRC" ]]; then | |
| echo "β Unit file not found at $SRC" >&2 | |
| exit 1 | |
| fi | |
| # Re-elevate via `sudo bash <abs-path>` so we don't depend on the script | |
| # having the executable bit set (git-from-Windows often drops it, and we | |
| # want `bash deploy/install_systemd.sh` to Just Work). | |
| if [[ "$(id -u)" -ne 0 ]]; then | |
| echo "β» Re-running with sudo..." | |
| exec sudo --preserve-env=HOME bash "$HERE/$(basename "${BASH_SOURCE[0]}")" "$@" | |
| fi | |
| # Sanity check the runtime paths referenced by the unit file. Catching this | |
| # now beats debugging a cryptic "ExecStart failed" later. | |
| PYTHON_BIN="/venvs/apps_venv/bin/python" | |
| PROJECT_DIR="/home/pollen/reachy_mini_receptionist" | |
| if [[ ! -x "$PYTHON_BIN" ]]; then | |
| echo "β Python interpreter not found at $PYTHON_BIN" >&2 | |
| echo " Fix: install / locate the apps_venv before re-running." >&2 | |
| exit 2 | |
| fi | |
| if [[ ! -d "$PROJECT_DIR" ]]; then | |
| echo "β Project not found at $PROJECT_DIR" >&2 | |
| exit 3 | |
| fi | |
| echo "β Installing $UNIT_NAME β $DST" | |
| cp "$SRC" "$DST" | |
| chmod 644 "$DST" | |
| echo "β Reloading systemd" | |
| systemctl daemon-reload | |
| echo "β Enabling on boot" | |
| systemctl enable "$UNIT_NAME" | |
| echo "β Restarting service" | |
| systemctl restart "$UNIT_NAME" | |
| # Brief wait so the status snapshot below shows a meaningful state | |
| sleep 2 | |
| echo | |
| echo "β Installed. Current status:" | |
| echo "βββββββββββββββββββββββββββββββββββββββββ" | |
| systemctl --no-pager --lines=10 status "$UNIT_NAME" || true | |
| echo "βββββββββββββββββββββββββββββββββββββββββ" | |
| echo | |
| echo "Follow logs: journalctl -u $UNIT_NAME -f" | |
| echo "Manual restart: sudo systemctl restart $UNIT_NAME" | |
| echo "Stop: sudo systemctl stop $UNIT_NAME" | |
| echo "Disable: sudo systemctl disable --now $UNIT_NAME" | |