0

When Domoticz and Grafana are open in Chromium on Raspberry Pi 3 b, it uses a lot of memory. That's why I want to close all chromium tabs automatically once a day. I can find a lot about the automatic startup of chromium, tab Domoticz and tab Grafana after a reboot but almost nothing about automatic shutdown. In ../etc/crontab I already tried to execute 0 5 * * * killall chromium browser. But that doesn't seem to work. Who knows the answer to this question.

This is what I get when tab "Domoticz" and tab "Grafana" are open in chromium:

pi@raspberrypi:~ $ ps -A | grep -i chrom
 9665 ?        00:00:26 chromium-browse
 9706 ?        00:00:00 chromium-browse
 9708 ?        00:00:00 chromium-browse
 9740 ?        00:00:01 chromium-browse
 9794 ?        00:00:07 chromium-browse
 9799 ?        00:00:37 chromium-browse
 9867 ?        00:00:04 chromium-browse
10103 ?        00:00:00 chromium-browse

I tried this:

    enter # /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
0 18    50 * *   pi      sudo killall chromium-browser-v7
#0  5    * * *   root    reboot
#0 17    * * *   root    reboot

I also tried user root

5
  • "chromium browser" is probably not the name of the process. Have a look at ps -A | grep -i chrom (notice, chrom not chrome). – goldilocks Aug 14 '19 at 15:24
  • Your comment is unreadable. Please edit your question and add the output to it. – Ingo Aug 14 '19 at 17:38
  • Just tried that and it doesn't do the job. – Copitano Aug 14 '19 at 23:26
  • Add the output to your question and format it as a code block (use the {} button – Dirk Aug 15 '19 at 9:20
  • Ahhhh, Done. See below the question above. – Copitano Aug 17 '19 at 12:56
1

It's not that hard to kill a program. You need the PID for it or the correct name.

For Chromium this would be chromium-browser I guess, so run killall chromium-browser.

You should also note that there is auto completion in bash. So if you type in killall chr and then hit the ⇥ TAB it will complete the right name if it's not ambiguous. Otherwise you could hit it twice to see the possibilities.

4
  • sudo killall chromium-browser-v7 did the trick. Thanks all. – Copitano Aug 17 '19 at 14:11
  • Unfortunately ~ S it works in the command line but not in the crontab. – Copitano Aug 17 '19 at 16:43
  • @Copitano for me it works. Are you sure you configured your crontab right? You should add that to your question otherwise nobody could help you with it. – jake Aug 17 '19 at 16:58
  • At 20:00 it worked with user pi. – Copitano Aug 17 '19 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.