Command to find process and restart it I have an issue with my Logitech Mouse software always crashing when it switches between different power modes, this crashes their software on Mac OS X (Yosemite).

The app is used to control the pointer speed and shortcut keys on the mouse, which renders the mouse useless,  I need to restart it every time I switch power states to get it working again.

Is there a command I can use in terminal that can kill the logitech process and start it again?

If I do a Logitech Gaming Software.app on ps -ax I can find the process, how can I pipe this to kill the associated PID and then restart the app?

Running ps -ax | grep 'Logitech Gaming Software.app will return the following:

 2879 ??         0:02.96 /Applications/Logitech/Logitech Gaming Software.app/Contents/MacOS/LCore
 2891 ttys000    0:00.00 grep Logitech Gaming Software.app
Here is what I'd try...  Create a bash script using the code below and save it as a plain text file without an extension.  Place it in a directory that in your $PATH, e.g. /usr/local/bin and make it executable using: chmod +x filename where filename is the name you gave the bash script.

#!/bin/bash
kill $(pgrep LCore)
sleep 1
open -a  "/Applications/Logitech/Logitech Gaming Software.app"


Now in a Terminal type the name you gave to filename and press Enter...

The $(pgrep LCore) portion of kill $(pgrep LCore) should pass the appropriate PID of /Applications/Logitech/Logitech Gaming Software.app/Contents/MacOS/LCore to kill and terminate its process, wait a second and then open the Logitech Gaming Software.app application bundle.