Results 1 to 7 of 7

Thread: /tmp, /var/tmp cleaned via crontab & MAX_DAYS_IN_TMP /etc/sysconfig Editor

  1. #1

    Default /tmp, /var/tmp cleaned via crontab & MAX_DAYS_IN_TMP /etc/sysconfig Editor

    In openSUSE 13.2 how does /tmp and /var/tmp get cleaned?

    There use to be system variables MAX_DAYS_IN_TMP, etc, in YaST /etc/sysconfig Editor, but I have not been successful in seeing how it is done now.

  2. #2
    Join Date
    May 2012
    Location
    Finland
    Posts
    2,012

    Default Re: /tmp, /var/tmp cleaned via crontab & MAX_DAYS_IN_TMP /etc/sysconfig Editor

    Copy /usr/lib/tmpfiles.d/tmp.conf to /etc/tmpfiles.d and edit the file according to your needs.

    You can find more information with; man tmpfiles.d
    .: miuku #suse @ irc.freenode.net
    :: miuku@opensuse.org

    .: h​ttps://download.opensuse.org/repositories/home:/Miuku/

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,402

    Default Re: /tmp, /var/tmp cleaned via crontab & MAX_DAYS_IN_TMP /etc/sysconfig Editor

    Thius is from the 12.3 Release Notes:
    5.2. systemd: Cleaning Directories (/tmp and /var/tmp)




    By default, systemd cleans tmp directories daily as configured in /usr/lib/tmpfiles.d/tmp.conf. Users can change it by copying /usr/lib/tmpfiles.d/tmp.conf to /etc/tmpfiles.d/tmp.conf and modifying the copied file. It will override /usr/lib/tmpfiles.d/tmp.conf.
    Note: systemd does not honor obsolete sysconfig variables in /etc/sysconfig/cron such as TMP_DIRS_TO_CLEAR.




    But the policy changed to NOT clean. This is from 13.1, so check on yoir 13.2:
    Code:
    boven:~ # cat /usr/lib/tmpfiles.d/tmp.conf
    #  This file is part of systemd.
    #
    #  systemd is free software; you can redistribute it and/or modify it
    #  under the terms of the GNU Lesser General Public License as published by
    #  the Free Software Foundation; either version 2.1 of the License, or
    #  (at your option) any later version.
    
    # See tmpfiles.d(5) for details
    
    # Clear tmp directories separately, to make them easier to override
    # SUSE policy: we don't clean those directories
    d /tmp 1777 root root -
    d /var/tmp 1777 root root -
    
    # Exclude namespace mountpoints created with PrivateTmp=yes
    x /tmp/systemd-private-*
    x /var/tmp/systemd-private-*
    X /tmp/systemd-private-*/tmp
    X /var/tmp/systemd-private-*/tmp
    boven:~ #
    And this is the file I generated on my system to overwrite the default behaviour:
    Code:
    boven:~ # cat /etc/tmpfiles.d/tmp.conf
    #  This file is part of systemd.
    #
    #  systemd is free software; you can redistribute it and/or modify it
    #  under the terms of the GNU Lesser General Public License as published by
    #  the Free Software Foundation; either version 2.1 of the License, or
    #  (at your option) any later version.
    
    # See tmpfiles.d(5) for details
    
    # De originele file staat in /usr/lib/tmpfiles.d/tmp.conf
    # Deze copie in /etc/tmpfiles.d overschrijft dat.
    
    # Clear tmp directories separately, to make them easier to override
    # Eigen policy: maak /tmp en /var/tmp leeg.
    D /tmp 1777 root root 1d
    D /var/tmp 1777 root root 1d
    
    # Exclude namespace mountpoints created with PrivateTmp=yes
    x /tmp/systemd-private-*
    x /var/tmp/systemd-private-*
    X /tmp/systemd-private-*/tmp
    X /var/tmp/systemd-private-*/tmp
    boven:~ #
    The differences between the two:
    Code:
    boven:~ # diff /usr/lib/tmpfiles.d/tmp.conf /etc/tmpfiles.d/tmp.conf 
    9a10,12
    > # De originele file staat in /usr/lib/tmpfiles.d/tmp.conf
    > # Deze copie in /etc/tmpfiles.d overschrijft dat.
    > 
    11,13c14,16
    < # SUSE policy: we don't clean those directories
    < d /tmp 1777 root root -
    < d /var/tmp 1777 root root -
    ---
    > # Eigen policy: maak /tmp en /var/tmp leeg.
    > D /tmp 1777 root root 1d
    > D /var/tmp 1777 root root 1d
    boven:~ #
    Henk van Velden

  4. #4
    Join Date
    Sep 2013
    Location
    Norfolk, UK
    Posts
    1,335

    Default Re: /tmp, /var/tmp cleaned via crontab & MAX_DAYS_IN_TMP /etc/sysconfig Editor

    Since openSUSE 12.3

    By default, systemd cleans tmp directories daily as configured in /usr/lib/tmpfiles.d/tmp.conf

    Users can change it by copying /usr/lib/tmpfiles.d/tmp.conf to /etc/tmpfiles.d/tmp.conf and modifying the copied file.

    It will override /usr/lib/tmpfiles.d/tmp.conf.


    Note: systemd does not honor obsolete sysconfig variables in /etc/sysconfig/cron such as TMP_DIRS_TO_CLEAR.
    Last edited by tannington; 10-Dec-2014 at 03:37. Reason: Slow typing... answered already :)
    Regards, Paul

    2x Tumbleweed (Snapshot: 20191211) KDE Plasma 5
    2x Leap 15.1 KDE Plasma 5

  5. #5

    Default Re: /tmp, /var/tmp cleaned via crontab & MAX_DAYS_IN_TMP /etc/sysconfig Editor

    # Clear tmp directories separately, to make them easier to override
    # SUSE policy: we don't clean those directories
    d /tmp 1777 root root -
    d /var/tmp 1777 root root -

    Before I guess it used to be 10d, wonder why they changed.
    Might not good for new user that are not aware.


    People who do not break things first will never learn to create anything

  6. #6

    Default Re: /tmp, /var/tmp cleaned via crontab & MAX_DAYS_IN_TMP /etc/sysconfig Editor

    Quote Originally Posted by Miuku View Post
    Copy /usr/lib/tmpfiles.d/tmp.conf to /etc/tmpfiles.d and edit the file according to your needs.

    You can find more information with; man tmpfiles.d
    I will do the copy and read the man page. My productive system is much older, so I'll have to read all those RELEASE NOTES. Hope they are still online.

    I have been doing reading and note taking, this was a particularlly interesting bug report, 860067 - "Systemd does not clear temporary files from /tmp and /var/tmp daily" and 908162. It seems folks are having a hard time these days even agreeing on what constitutes a tmp directory. Argh. Are we following FHS these days, or no?

    3.17. /tmp : Temporary files
    3.17.1. Purpose
    The /tmp directory must be made available for programs that require temporary files.
    Programs must not assume that any files or directories in /tmp are preserved between invocations of the
    program. ~FHS_2.3
    My pre-install and testing is not going as easily as past installs. I am busy fixing things as I run across them.

    Thank you.

  7. #7
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,897
    Blog Entries
    3

    Default Re: /tmp, /var/tmp cleaned via crontab & MAX_DAYS_IN_TMP /etc/sysconfig Editor

    Quote Originally Posted by opensuseforumorg42 View Post
    It seems folks are having a hard time these days even agreeing on what constitutes a tmp directory.
    Nineteen years ago ago (running slackware at that time), I had some files in "/tmp" because I had not decided on a permanent place for them. The stayed in "/tmp" for around 5 years or more. If it's your system, then "tmp" is what you want it to be.

    These days I'm a tad more organized, so I use "$HOME/tmp" for files that I haven't decided where to permanently put them or whether to permanently keep them.
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •