cancel
Showing results for 
Search instead for 
Did you mean: 
Tanveer
Flight Engineer
Flight Engineer
  • 2,900 Views

RH-134 LAB

As-salamu alaykum,

Dear All,

RH-134, COMPREHENSIVE REVIEW, LAB 3, Question 9

Question 9:- Configure your system so that it uses a new directory called /run/volatile to store
temporary files. Files in this directory should be subject to time based cleanup if they are not
accessed for more than 30 seconds. The octal permissions for the directory must be 0700.
Make sure that you use the /etc/tmpfiles.d/volatile.conf file to configure the time
based cleanup for the files in /run/volatile.

Answer from Book:-

Create a file called /etc/tmpfiles.d/volatile.conf with the following content.
d /run/volatile 0700 root root 30s

Use the systemd-tmpfiles --create command to create the /run/volatile
directory if it does not exist.


[root@servera ~]# systemd-tmpfiles --create /etc/tmpfiles.d/
volatile.conf

Confusing point for me is that answer has no configuration for systemd timer unit and question ask about time based clean up.

If someone gets it, please show some lights to me

Labels (1)
7 Replies
JS_Learning
Moderator
Moderator
  • 2,880 Views

Hi there,

I'm not sure I understood well your question, and I don't have access to your course material.

In your case, the time base cleanup would be effective when running, if I am not mistaken:

 

systemd-tmpfiles --clean /etc/tmpfiles.d/volatile.conf 

There is also the option to "remove marked files/directories":

systemd-tmpfiles --remove

What can be done in your case would be to create the folder and then a file:

systemd-tmpfiles --create /etc/tmpfiles.d/volatile.conf

touch /run/volatile/testfile.test

Verify the file is still present:

ls -lrt /run/volatile/testfile.test

Then run the config to clean:

systemd-tmpfiles --clean /etc/tmpfiles.d/volatile.conf 

Verify again, then have your terminal wait for 30s (since that's your setting):

sleep 30

then verify again, the file should be gone.

Cheers,

 

0 Kudos
Tanveer
Flight Engineer
Flight Engineer
  • 2,872 Views

it is not deleting the files automatically, but only if i run systemd-tmpfiles --clean /etc/tmpfiles.d/a.conf

0 Kudos
Tracy_Baker
Starfighter Starfighter
Starfighter
  • 2,870 Views

I think a little more to the point...

The "30s" in the volatile.conf configuration is the "timer", which is activated with the systemd-tmpfiles command.

No separate systemd unit configuration is required.

Program Lead at Arizona's first Red Hat Academy, est. 2005
Estrella Mountain Community College
JS_Learning
Moderator
Moderator
  • 2,833 Views

I think the other student is confused with what is triggering the cleaning.

I actually realize that I did not fully understand the topic either.

I know one can manually trigger the cleaning (systemd-tmpfiles --clean ....conf).

I know one running "systemd-tmpfiles" would trigger lot of cleanings, including the one we "created" using systemd-tmpfiles.

But how are we expected to schedule this? in a crontab? or automatically, systemd-tmpfiles is a running process and always watch and execute all its config?

So we are supposed to enable and run "systemd-tmpfiles" related service?

Cheers,

 

Tanveer
Flight Engineer
Flight Engineer
  • 2,868 Views

but it is not deleting files and folder in the destination dir.

 

0 Kudos
Tracy_Baker
Starfighter Starfighter
Starfighter
  • 2,849 Views

Generally, when I've seen this happen (not deleting content) with my students, is almost always due to a typo. Maybe this helps?

Program Lead at Arizona's first Red Hat Academy, est. 2005
Estrella Mountain Community College
0 Kudos
Tanveer
Flight Engineer
Flight Engineer
  • 2,859 Views

It seems like time filed in a.conf file is the time period, after that i can fire up systemd-tmpfiles --clean/remove /etc/tmpfiles.d/a.conf and then it will delete the files and folder, not before the that, but what i think that it should delete the files in the destination dir after specified time automatically without me typing the command instead.

0 Kudos
Join the discussion
You must log in to join this conversation.