#!/bin/bash # Oneliner to find script's directory. Please note - last path component should NOT be symlink. SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; for pid in $(pidof -x run_agent.sh); do if [ $pid != $$ ]; then echo "[$(date)] : run_agent.sh : Process is already running with PID $pid. Exiting." exit 1 fi done while : do # To avoid problems with pulseaudio python3 -u $SCRIPT_DIR/src/agent_kill.py pkill pulseaudio python3 -u $SCRIPT_DIR/src/agent_gsm.py --config $SCRIPT_DIR/config/agent.yaml done