0

I have a systemd service that must be restarted whenever Chromium-browser opens/launches.

[Unit]
Description=Load cgroup configs
After=multi-user.target

[Service]
Type=forking
ExecStartPre=/bin/echo "Processing /etc/cgconfig.conf ..."
ExecStartPre=/usr/sbin/cgconfigparser -l /etc/cgconfig.conf
ExecStartPre=/bin/echo "Processing /etc/cgrules.conf ..."
ExecStart=/usr/sbin/cgrulesengd --logfile=/var/log/cgrulesengd.log
Restart=on-failure

[Install]
WantedBy=multi-user.target

This service is used to process the configuration files that are used to limit the CPU and Memory usage of Chromium-browser using CGroups.

This service is activated on the boot and then when I open the chromium browser and run the following commands, it return nothing.

cat /sys/fs/cgroup/cpu/browsers/tasks
cat /sys/fs/cgroup/memory/browsers/tasks

BUT then I have to restart the service manually service <service_name> restart. After that, above commands return the PIDs used by the Chromium browser. For example

5314
5347
5349
5403
5603

How can I automate this service to restart automatically whenever there is a chromium launch? and I don't have to restart the service manually again and again.

1 Answer 1

0

If you set the rules correctly, you should be able to do this without having to restart this service.

Some of these resources maybe helpful:

2
  • Please explain how the asker should go about setting the rules correctly; answers should be self-contained, without requiring the readers to follow links. (Links are still useful to provide more information or references, but they shouldn’t be necessary to use the answer.) Jul 3, 2019 at 12:19
  • These are the basics things which everyone will try to search before asking any question here. Should not count as an answer. -1 Jul 4, 2019 at 6:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .