#!/bin/bash # One unit runs the whole robot (face, camera, vision, audio, MCP bridge) via the hermes_bringup launch file, so # the face is up whenever the robot is powered, and everything is ROS. Each node is its own process # and is respawned by the launch file, so one crash cannot take the others down. # Replaces the earlier standalone robot-face.service. Run as root from this directory. Re-runnable. set -euo pipefail cd "$(dirname "$0")" # The MCP bridge's bearer token: created once, readable only by root and the service user, and never # printed (read it yourself with `sudo cat /etc/robot-mcp.env` when configuring the host). if [ ! -s /etc/robot-mcp.env ]; then (umask 077; printf 'ROBOT_MCP_TOKEN=%s\n' "$(openssl rand -hex 32)" > /etc/robot-mcp.env) fi chown root:hermes /etc/robot-mcp.env chmod 640 /etc/robot-mcp.env install -m 644 robot-cpu-performance.service robot.service /etc/systemd/system/ systemctl disable --now robot-face.service 2>/dev/null || true rm -f /etc/systemd/system/robot-face.service systemctl daemon-reload systemctl enable --now robot-cpu-performance.service systemctl enable robot.service systemctl restart robot.service echo "robot.service enabled and started"