Auto cleanup of /tmp?

Hello,

I would like to understand if there are any system process defined on SLES 11.4 that takes care of deletion of files and directories under /tmp filesystem?

On RHEL 7 and later versions, I see systemd does a cleanup of /tmp filesystem based on the config file /usr/lib/tmpfiles.d/tmp.conf

Do we have a similar setup on SLES 11.4?

Thanks and Regards
Akshay

[QUOTE=HBAkshay;59136]Hello,

I would like to understand if there are any system process defined on SLES 11.4 that takes care of deletion of files and directories under /tmp filesystem?

On RHEL 7 and later versions, I see systemd does a cleanup of /tmp filesystem based on the config file /usr/lib/tmpfiles.d/tmp.conf

Do we have a similar setup on SLES 11.4?

Thanks and Regards
Akshay[/QUOTE]
Hi and welcome to the Forum :slight_smile:
Yes, this is taken care of via a cron job, you can also configure in YaST sysconfig editor under ‘cron’.

From memory there maybe a /etc/tmpfiles directory(?)

[QUOTE=malcolmlewis;59137]Hi and welcome to the Forum :slight_smile:
Yes, this is taken care of via a cron job, you can also configure in YaST sysconfig editor under ‘cron’.

From memory there maybe a /etc/tmpfiles directory(?)[/QUOTE]

Thank you.

I couldn’t find /etc/tmpfiles directory on my SLES 11.4 box.

Reason for asking the question is because lately we migrated our server from SUSE to RHEL. Post migration to RHEL, some of the application files stored under /tmp is getting deleted which was not the case on SUSE.

So, may I know what’s the default behavior/configuration with regard to /tmp cleanup on SLES 11.4?

Thanks and Regards
Akshay

[QUOTE=HBAkshay;59138]Thank you.

I couldn’t find /etc/tmpfiles directory on my SLES 11.4 box.

Reason for asking the question is because lately we migrated our server from SUSE to RHEL. Post migration to RHEL, some of the application files stored under /tmp is getting deleted which was not the case on SUSE.

So, may I know what’s the default behavior/configuration with regard to /tmp cleanup on SLES 11.4?

Thanks and Regards
Akshay[/QUOTE]
Hi
From memory in that version it was all listed in /etc/sysconfig/cron did this file migrate over?

## The Parameters MAX_DAYS_IN_TMP, MAX_DAYS_IN_LONG_TMP, TMP_DIRS_TO_CLEAR, 
## LONG_TMP_DIRS_TO_CLEAR, CLEAR_TMP_DIRS_AT_BOOTUP and OWNER_TO_KEEP_IN_TMP have 
## been converted to systemd-tmpfiles settings in /etc/tmpfiles.d/tmp.conf.
## Please check and modify to your needs.
## See 'man tmpfiles.d' for details.

So there should also be on the new system a /etc/tmpfiles.d/tmp.conf?

[QUOTE=malcolmlewis;59139]Hi
From memory in that version it was all listed in /etc/sysconfig/cron did this file migrate over?

## The Parameters MAX_DAYS_IN_TMP, MAX_DAYS_IN_LONG_TMP, TMP_DIRS_TO_CLEAR, 
## LONG_TMP_DIRS_TO_CLEAR, CLEAR_TMP_DIRS_AT_BOOTUP and OWNER_TO_KEEP_IN_TMP have 
## been converted to systemd-tmpfiles settings in /etc/tmpfiles.d/tmp.conf.
## Please check and modify to your needs.
## See 'man tmpfiles.d' for details.

So there should also be on the new system a /etc/tmpfiles.d/tmp.conf?[/QUOTE]

/etc/sysconfig/cron is available on my SLES 11.4 box and MAX_DAYS_IN_TMP is set to 0. So per my understanding, when this parameter is set to 0, tmp filesystem cleanup doesn’t happen and believe this is the default setting when the system is built.

Is my understanding correct?

And, may I know on which version of SUSE box, below config entries shared by you are defined?

## The Parameters MAX_DAYS_IN_TMP, MAX_DAYS_IN_LONG_TMP, TMP_DIRS_TO_CLEAR, 
## LONG_TMP_DIRS_TO_CLEAR, CLEAR_TMP_DIRS_AT_BOOTUP and OWNER_TO_KEEP_IN_TMP have 
## been converted to systemd-tmpfiles settings in /etc/tmpfiles.d/tmp.conf.
## Please check and modify to your needs.
## See 'man tmpfiles.d' for details.

[QUOTE=HBAkshay;59141]/etc/sysconfig/cron is available on my SLES 11.4 box and MAX_DAYS_IN_TMP is set to 0. So per my understanding, when this parameter is set to 0, tmp filesystem cleanup doesn’t happen and believe this is the default setting when the system is built.

Is my understanding correct?

And, may I know on which version of SUSE box, below config entries shared by you are defined?

[CODE]

The Parameters MAX_DAYS_IN_TMP, MAX_DAYS_IN_LONG_TMP, TMP_DIRS_TO_CLEAR,

LONG_TMP_DIRS_TO_CLEAR, CLEAR_TMP_DIRS_AT_BOOTUP and OWNER_TO_KEEP_IN_TMP have

been converted to systemd-tmpfiles settings in /etc/tmpfiles.d/tmp.conf.

Please check and modify to your needs.

See ‘man tmpfiles.d’ for details.

[/CODE][/QUOTE]
Hi
Yes, that’s also my understanding. That file (/etc/sysconfig/cron) is in all the current releases (SLE and openSUSE), In this case it was from “SUSE Linux Enterprise Server 12 SP3”.

[QUOTE=malcolmlewis;59143]Hi
Yes, that’s also my understanding. That file (/etc/sysconfig/cron) is in all the current releases (SLE and openSUSE), In this case it was from “SUSE Linux Enterprise Server 12 SP3”.[/QUOTE]

So, on SLES 11 (11 SP4 in my case) auto cleanup of tmp doesn’t happen by default as per our understanding.

Thank you for all your responses.

[QUOTE=HBAkshay;59144]So, on SLES 11 (11 SP4 in my case) auto cleanup of tmp doesn’t happen by default as per our understanding.

Thank you for all your responses.[/QUOTE]

With SLES11 automatic cleanup of /tmp/ is disabled by default but can configured and enabled via /etc/sysconfig/cron.

HTH.

[QUOTE=smflood;59153]With SLES11 automatic cleanup of /tmp/ is disabled by default but can configured and enabled via /etc/sysconfig/cron.

HTH.[/QUOTE]

Thanks for confirming.

Yes, I see the default value for the parameter MAX_DAYS_IN_TMP is set to 0. Setting this to a non-zero value should enable auto cleanup of /tmp.