Thanks to the compatibility of systemd to sysV I use a simple start routine that purges /tmp in FC 16. The command line
/usr/sbin/tmpwatch -m -Maq 24h /tmp
is the only action which is done by the init.d script (just once, no daemon service).
Is there anyone who can explain to me how to implement this in systemd style?
---------- Post added at 11:24 PM ---------- Previous post was at 10:11 PM ----------
Quote:
Originally Posted by acorlato
Thanks to the compatibility of systemd to sysV I use a simple start routine that purges /tmp in FC 16. The command line
/usr/sbin/tmpwatch -m -Maq 24h /tmp
is the only action which is done by the init.d script (just once, no daemon service).
Is there anyone who can explain to me how to implement this in systemd style?
|
I found out that there is already a mechanism for it:
>>> cat
/lib/systemd/system/systemd-tmpfiles-clean.service
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=Cleanup of Temporary Directories
DefaultDependencies=no
Wants=local-fs.target
After=systemd-readahead-collect.service systemd-readahead-replay.service local-fs.target
Before=sysinit.target shutdown.target
ConditionDirectoryNotEmpty=|/usr/lib/tmpfiles.d
ConditionDirectoryNotEmpty=|/usr/local/lib/tmpfiles.d
ConditionDirectoryNotEmpty=|/etc/tmpfiles.d
ConditionDirectoryNotEmpty=|/run/tmpfiles.d
[Service]
Type=oneshot
ExecStart=/bin/systemd-tmpfiles --clean
IOSchedulingClass=idle