Newbie neeeds Help with bash Script into a daemon

Hello I’m sorta new to Linux keyword “Sorta”. I currently just decide to install Endeavour on my old surface pro 3. Everything works fine like it should the issue I wrote I a bash script to check and see if the keyboard is connect or not and if it is not then it will execute onboard. the question I have is there anyway to run my script as a daemon to run ever i don’t know 5 seconds to check if the keyboard is connected ?


          lsusb | grep  " 045e:07e2"






Thanks again !!!

You could call it from a systemd timer to run every 5 seconds.

Unless it needs root, use a --user timer.

EDIT: That script is overcomplicated. You don’t need an else statement or any of those exit commands. Just test if the string is empty with -z. It could easily be made a one-liner.