1
0
Fork 0
speechd/scripts/speechd-toggle

21 lines
369 B
Bash
Executable file

#!/bin/bash
PIDFILE="${XDG_RUNTIME_DIR:-/tmp}/speechd.pid"
[ -f "$PIDFILE" ] || {
echo "Daemon not running (no pidfile)" >&2
exit 1
}
PID=$(cat "$PIDFILE")
kill -0 "$PID" 2>/dev/null || {
echo "Daemon not running (stale pidfile)" >&2
exit 1
}
case "$1" in
"-n") kill -USR2 "$PID";;
"-a") kill -ALRM "$PID";;
*) kill -USR1 "$PID";;
esac