#!/usr/bin/env bash # dev-restart.sh — restart Cortex on the gaming laptop and tail logs # Usage: # ./dev-restart.sh restart and show last 30 log lines # ./dev-restart.sh logs tail live logs (ctrl-c to stop) # ./dev-restart.sh status show service status only # "scott-lt-i7-rtx" or "192.168.32.19" CORTEX_HOST="scott-lt-i7-rtx" # hostname or IP of the machine running Cortex SERVICE="cortex" case "${1:-restart}" in logs) echo "→ Tailing $SERVICE logs on $CORTEX_HOST (ctrl-c to stop)" ssh "$CORTEX_HOST" "journalctl --user -u $SERVICE -f --no-pager" ;; status) ssh "$CORTEX_HOST" "systemctl --user status $SERVICE --no-pager -l" ;; restart|*) echo "→ Restarting $SERVICE on $CORTEX_HOST …" ssh "$CORTEX_HOST" "systemctl --user restart $SERVICE" echo "→ Last 30 log lines:" ssh "$CORTEX_HOST" "journalctl --user -u $SERVICE --no-pager -n 30" ;; esac