Thread: [SailfishOS] WhoGo Maps
View Single Post
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#152
Originally Posted by pichlo View Post
I've been thinking about a one-liner too. Something along the lines of...
Code:
ps aux | grep whogo* | cut -d " " -f 2 | xargs kill -9
(Caveat: not tried yet.)
I had some problems with cut. I could not convince it to use multiple spaces as a single delimiter. So I had to expand the line a bit but it seems to work now:
Code:
ps aux | grep whogo | grep -v grep | grep -v sh | sed -e "s/\s\{1,\}/ /" | cut -d " " -f 2 | xargs kill
It is tested and it works (yes, I had to trigger the issue again to test it but that part was easy).

What it does:
  • ps aux lists the running processes;
  • The first grep filters out only those processes with "whogo" anywhere in the command line that started it - be it in the name or arguments;
  • The second grep eliminates the grep process itself from the results;
  • The third grep is only useful if you use the attached script - it eliminates the grep script itself from the results;
  • sed merges multiple spaces into a single space;
  • cut splits each line of output into fields, using a space as a delimiter and letting only the second field (the one containing the process ID, or PID) through;
  • xargs collects the output (which by now is a few lines, each containing just the PID of a WhoGo process) into an argument list for the kill command.

I am attaching the line as a script. Copy it into /home/nemo, remove the .txt extension (I had to add it to pacify the TMO uploader) and run from the command line like this:
Code:
sh whogo-kill
Or add the execute permission and run it like this:
Code:
./whogo-kill
Attached Files
File Type: txt whogo-kill.txt (116 Bytes, 40 views)
__________________
Русский военный корабль, иди нахуй!

Last edited by pichlo; 2018-07-09 at 12:00. Reason: Typo: anywhere -> anyway. D'oh!
 

The Following 3 Users Say Thank You to pichlo For This Useful Post: