Thread: [SailfishOS] WhoGo Maps
View Single Post
nthn's Avatar
Posts: 764 | Thanked: 2,888 times | Joined on Jun 2014
#155
Originally Posted by pichlo View Post
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
I don't know what the 'invoker' process is responsible for, but going by the name I'm assuming it isn't the one hanging in the background, so in that case I think you've just created a very complicated way of doing:
Code:
pkill harbour-whogo-maps
Props regardless!
 

The Following 5 Users Say Thank You to nthn For This Useful Post: