From 183dfe3ae34418653aca3d20628b3938c8348c2a Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 28 Sep 2026 12:58:42 +0200 Subject: Replace restart.sh with assistant.sh start|stop|restart|status start leaves a running assistant or overlay alone and starts only what is missing; restart is the old restart.sh. status lists each process with its uptime, memory and children, a stray arecord left by a dead assistant, the socket, the presentation/gaming pause flags and the log's last lines, and exits 1 if either process is down. Co-Authored-By: Claude Opus 5.5 --- restart.sh | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100755 restart.sh (limited to 'restart.sh') diff --git a/restart.sh b/restart.sh deleted file mode 100755 index 24dd5ea..0000000 --- a/restart.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# desktop-assistant: restart the voice loop, detached from the terminal. -# Copyright (C) 2026 Danilo M. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# restart.sh: SIGTERM any running assistant.py (whisper-server and amixer -# die with it through PDEATHSIG), SIGKILL after 10 s, then start a new one -# in its own session, logging where the Hyprland autostart does. The -# quickshell overlay (OVERLAY, default the quickshell repo next to this one) -# is restarted the same way. Run it from the login session: it needs its -# audio, bus, Wayland display and XDG_RUNTIME_DIR. - -set -eu - -dir=$(cd "$(dirname "$0")" && pwd) -log="${XDG_RUNTIME_DIR:?not in a login session}/desktop-assistant.log" -overlay=$(realpath -m "${OVERLAY:-$dir/../quickshell/assistant}") -pat='^\S*python3 (-u )?\S*assistant\.py' -qpat="^qs -p $overlay\$" - -stop() { - pkill -u "$USER" -f "$1" || return 0 - for _ in $(seq 50); do - pgrep -u "$USER" -f "$1" >/dev/null || return 0 - sleep 0.2 - done - pkill -KILL -u "$USER" -f "$1" && sleep 0.5 || true -} - -stop "$pat" -stop "$qpat" - -cd "$dir" -setsid -f python3 -u "$dir/assistant.py" >>"$log" 2>&1 /dev/null 2>&1 &2; exit 1; } -pgrep -u "$USER" -af "$qpat" || { echo "overlay not running: qs -p $overlay" >&2; exit 1; } -- cgit v1.2.3