[systemd-devel] Adding a Timer section to .service files

Lennart Poettering lennart at poettering.net
Fri Jul 8 16:16:51 UTC 2016


On Fri, 08.07.16 16:35, One Infinite Loop (6pozmo at gmail.com) wrote:

> A few usecases:
> 1) I want to delete specific files once a day

For this you probably should be using tmpfiles' "aging" logic, and not
define your own timer.

> 2)I want to free RAM using sync command and `echo 3 >
> /proc/sys/vm/drop_caches` every 15 seconds

Uh. Oh. I don't see why anyone would want to do this...

> 3)I want to make sure certain processes always run using a specific nice
> value like -15. I know control groups are invented but it's not the same
> thing.

Doing this with a service timer appears very strange to me. Simply set
"Nice=-15" in the unit file starting your service and the nice level will
be properly inherited by all processes of your services.

But, in general, you could do all of the above with a combination of
.timer and .service file just fine already. These usecases are
perfectly covered, the only difference between what you are proposing
and what has been implemented is whether it's adding two unit files
per item instead of one, which I don't think is too bad...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list