Home > OS >  killall & pkill can't find a daemon that is running and belongs to me
killall & pkill can't find a daemon that is running and belongs to me

Time:03-10

Frequently, I discover that my mouse won't scroll. The solution to this is to quit Logi Options Daemon through the Activity Monitor. I'd like to do this with a shell script, so that I can assign a hotkey, but I can't figure out how to kill the process by name.

➜  ~ killall "Logi Options Daemon"
No matching processes belonging to you were found
➜  ~ sudo killall "Logi Options Daemon"
Password:
No matching processes were found
➜  ~ sudo killall -9 "Logi Options Daemon"
No matching processes were found
➜  ~ pkill -f "Logi Options Daemon"
➜  ~ pgrep -f "Logi Options Daemon"

If I run ps | grep "Logi Options Daemon", I get a different PID each time, but the PID in Activity Moniter isn't changing. Using kill with the ID from Activity Monitor, does kill the process, but defeats the purpose of using a script.

How can I make this process die?

CodePudding user response:

According to this blog post from Chris Pennington, the actual name of the program is LogiMgrDaemon, so try:

killall LogiMgrDaemon

You can find this name in Activity Monitor by selecting the process, opening its Info window (with Command-I or the "I" button in the toolbar), and looking under the Open Files and Ports tab for the binary name & path.

As for what you see when you run ps | grep "Logi Options Daemon", you're probably just seeing the grep process itself. Note the "grep" in the process listing here:

$ ps | grep "No Such Daemon"
36074 ttys006    0:00.00 grep No Such Daemon

This is an extremely common problem with ps | grep, and pretty much the entire reason that pgrep exists as a separate program.

  • Related