0

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.

asked Mar 13, 2025 at 13:26

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.