answered
2016-09-23 14:51:07 +0300
I had the same problem. A bunch of useless background android process consuming valuable RAM.
For myself I made duct tape solution: I have added sudo pkill $UNWANTED_STUFF
to my maintenance script, which is scheduled to run once every hour.
I can describe in more details my setup if you would like to replicate.
UPD: My solution in more details
This guide assumes you are familiar with unix command line and can perform arbitrary command on device as root
First of all you need to identify names of process that you want to be killed. Related tools: top
, htop
, ps
. Compose pattern to match you process and check with pgrep
(further reading — man pgrep
, man pkill
). You'll probably will need -f
CLI switch of pgrep. One of my matches: pgrep -f org.mozilla.firefox:search
pkill $PATTERN
for android process does not work at this stage as android apps run with different user id. To make user nemo capable of killing desired processes you'll need sudo
tool. You may use this package with sudo. Then we add rule to run specific command. Better create separate file for this rules in /etc/sudoers.d
. My example:
# grep pkill /etc/sudoers.d/nemo-self
nemo ALL=(root) NOPASSWD: /usr/bin/pkill -f ru.yandex.\*\:Metrica
nemo ALL=(root) NOPASSWD: /usr/bin/pkill -f org.mozilla.firefox\:search
Note that colons and asterisk require escaping. More info: man sudoers
.
Create shell script which calls pkill
with your pattern. Make sure it works by running manually.
Now scheduling part. I've seen people using cron on Jolla, but I prefer to use native timed-qt5
daemon. Earlier discussion of timed.
Schedule your script: timedclient-qt5 -a'whenDue;runCommand=/home/nemo/PATHTOYOURSCRIPT' -r'hour=22;minute=31;everyDayOfWeek;everyDayOfMonth;everyMonth' -e'APPLICATION=killer_sh;TITLE=Kills unwanted processes'
.
timed-qt5
can use list of values for hour and minute, but timedclient-qt5
sdeems buggy and can't provide list. I had to manually fix file with job list (/home/nemo/.timed/events.data
) to specify several hours to run check script:
hour = $h08|$h09|$h10|$h11|$h12|$h13|$h14|$h15|$h16|$h17|$h18|$h19|$h20|$h21|$h22|$h23
Then replaced original file with modified:
systemctl --user stop timed-qt5.service && cp -v events.data_fix events.data && systemctl --user start timed-qt5.service
iirc @schturman has an app for killing some droid processes if inactive
coderus ( 2016-09-23 10:21:57 +0300 )edit@coderus no, unfortunally he didn´t write it yet or i didn´t find it here Schturman´s applications
evo3de ( 2016-09-23 10:46:56 +0300 )edit