systemd-tmpfiles --clean
I'm having difficulty understanding, even after reading the man pages about the systemd-tmpfiles cleanup portion of the service.
I basically want to delete all files that are in my /data/analyst directory when they are older than a certain amount of time (I haven't decided yet, but let's say 2 minutes). Here is what I know: I came across some good reading on the manpage for tmpfiles.d which said it would read conf files from /etc/tmpfiles.d /run/tmpfiles.d and /usr/lib/tmpfiles.d So I figured I'd put a conf file in /etc/tmpfiles.d Code:
#touch /etc/tmpfiles.d/new_tmpfile.conf Code:
# vim /etc/tmpfiles.d/new_tmpfile.conf I used D because man page said that "D Create or empty a directory". I'm looking to empty a directory... Anyway...what am I missing, and / or do I need to restart a service? Thanks SK |
Quote:
This one delete files older than 5 days Code:
find /data/analyst/ -mindepth 1 -mtime +5 -delete Code:
find /data/analyst/ -mindepth 1 -mmin +2 -delete Code:
find /path/to -type d -empty -delete Code:
crontab -e Code:
#min hour day month weekday command |
Hey dab,
That's an awesome and great cron solution for sure. But I was reading on the benefits of systemd timers, and the main benefits come from each job having its own systemd service. Here is what I found in my reading up on them: ◾ Jobs can be easily started independently of their timers. This simplifies debugging. ◾ Each job can be configured to run in a specific environment (see the systemd.exec(5) man page). ◾ Jobs can be attached to cgroups. ◾ Jobs can be set up to depend on other systemd units. ◾ Jobs are logged in the systemd journal for easy debugging. The problem is, I just don't know how to set it up. I can't find a clear procedure from start to finish with examples and explanations. I'd really like to dive into this since its something I've never used, and learn it so I can have another 'tool in the toolbox' for my UNIX skillset =) Any ideas? SK |
Well I haven't used systemd in awhile, however lets try this post
Code:
grep -v '^#' /usr/lib/systemd/system/systemd-tmpfiles-clean.timer Code:
grep -v '^#' /usr/lib/systemd/system/systemd-tmpfiles-clean.service EDIT: also if everything is set up right you should be able to do below to start the cleanup of tmpfiles Code:
systemd-tmpfiles --clean |
Your problem is that systemd isn't quite ready for that.
The cron specification should work for you at this time. It is both simpler, and easier to control. |
Appreciate the feedback dab and jpollard, I'll look into it more. I do agree that cron would work. However, I'm trying to develop a new skill using systemd that Red Hat has implemented.
|
Quote:
In theory, it can be a session manager and I think that is what they will turn it into... When they successfully do that, it would be the program started instead of using the startup shell script, and will respawn various Gnome services if/when they die (control panels, window managers, the auto start scripts). Personally, I think it a waste of time, memory and system resources (systemd right now takes almost 30MB just doing that) adding yet more instances is much bigger than a shortlived shell process that turns into the window manager. Systemd right now can handle a laptop fairly well (a relatively simple startup), but I'm not yet convinced it can actually handle really large servers --- It still seems to have trouble mounting complex filesystems, getting things done properly with network startup, has forced daemon services to use non-standard coding for them to even work (each daemon has to tell systemd when it has really started... which wasn't necessary before, and cannot monitor standard daemons). It also still has trouble getting site specific startup procedures going (it gets tricky... and if you don't get it right it can randomly not work... or not shutdown properly). |
Good points, I'll wait until possibly RH8 when the systemd is a bit more usable / stable for things like this. Thanks for the feedback, much appreciated.
|
If you want to stay on the bleeding edge of the systemd tech then grab fedora or arch for your laptop/home system. Its fun to see where it is going and keeping up with all the changes which will eventually end up in the enterprise distros.
|
Don't wait too long! In RH8 systemd might be replaced by monsterd that consumes 500 megabytes RAM and has the desktop integrated.
Just kidding. |
Quote:
|
Coming Soon: RHEL 8.0 kernelD
|
All times are GMT -5. The time now is 10:41 AM. |