how to automate kill PIDs to solve `Could not claim the USB device`?

I have the same problem in this link, but the problem is I want to automate this process in an executable file, without the need to kill first PIDs every time. in fact, I want my executable file to detect these PIDs each time, and then kill them if necessary.

Do you have any idea how to do so?

1

1 Answer

Bash script I wrote for me when I had this problem:

#!/bin/bash
kill_args=$(pgrep gphoto) if [-z $kill_args]; then echo "Arguments are:: $( pgrep gphoto )" pgrep gphoto | xargs kill else echo "No gphoto process" fi

This script Kills all active gphoto processes. I am uncertain if that will help in you bcase.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like