I want a script that checks if steam link is running on my raspberry pi 5 with raspberry OS.
Hi all,
I wrote a script that should check if steam link is running. If it runs the script should stop xboxdrv. If steam link is stopped xboxdrv should start again. This is my attempt:
process_string="steamlink"
while true
do
if pgrep -x "$process_sring">/dev/null
then
echo "running"
if pgrep -x "xboxdrv">/dev/null
then
echo "stopping xboxdrv"
pkill -x "xboxdrv"
fi
else
echo "stopped"
if ! pgrep -x "xboxdrv">/dev/null
echo "start xboxdrv"
xboxdrv --detach-kernel-driver --silent --mouse &
fi
fi
sleep 3
done
When I type in firefox as the process string it works. It starts and stops with firefox. I guess I'm using the wrong process name but I can't find anything online. What can I do to make it work?
Thanks in advance for your answers.