Spaces:
Running
Running
File size: 2,548 Bytes
06a1901 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #!/usr/bin/env bash
#
# 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"
|