Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Clear Temp Files at Boot

  1. #1
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    36,729
    Blog Entries
    20

    Default Clear Temp Files at Boot

    To Clear /tmp Files at Boot

    Doing this will help prevent 'crud' from building up and taking up disc space. This guide to remove files from /tmp provides the basic requirement that should satisfy most users.

    Open Yast /etc/sysconfig Editor


    Navigate to System - Cron - Max_Days_In_Temp and set to 1


    Next confirm the dir to clear is /tmp


    Then to: Clear_Temp_Dirs_AT_Bootup and change to yes


    Accept the changes.

    /tmp will be cleared at re-boot.
    Leap 15.1_KDE
    My Articles Was I any help? If yes: Click the star below

  2. #2

    Default Re: Clear Temp Files at Boot

    Just a little comment.

    If you choose to clear /tmp at bootup and /tmp is the only directory to be cleared, setting MAX_DAYS_IN_TEMP is rather useless or can be even dangerous if you only set it to 1 day.

    If there are temporary files which are needed for a longer time (no, I don't have an example at the moment) which will be automatically cleared after 1 day and some application still wants to access that file later => problem.

    Leaving the default value (5 days IIRC //Edit: actually it's 0 = don't clean automatically) is the safer way, still everything will be cleared up on next boot.

  3. #3

    Default Re: Clear Temp Files at Boot

    Never had a problem doing this. I'm actually running /tmp in RAM so that it is fast, secure, and completely purged at shutdown. Nothing is stored onto HDD. In addition I lock down /tmp for additional security.

    There are some interesting suggestions, including how to make /tmp a RAM-based filesystem, here: Hardening a Linux or OpenBSD Installation

  4. #4
    Join Date
    Jun 2008
    Location
    UK
    Posts
    5,500

    Default Re: Clear Temp Files at Boot

    suezuh thank you for that link. I will give the /tmp in RAM a try.
    Cheers

  5. #5

    Default Re: Clear Temp Files at Boot

    You're welcome. Just for example, here's my fstab entry:
    none /tmp tmpfs rw,noexec,nosuid,nodev,noatime,nodiratime,size=200M 1 2

    The max size of /tmp in my RAM is set at 200 megs. Set it to whatever you need. The actual size varies in RAM depending on system requirements.

    Firefox cache is also set to run in /tmp, and therefore in RAM. I've set that to 50M.

  6. #6
    Andy Sipowicz NNTP User

    Default Re: Clear Temp Files at Boot

    > none /tmp tmpfs
    > rw,noexec,nosuid,nodev,noatime,nodiratime,size=200M 1 2


    oh no! does a tmpfs automatically run in RAM?? i failed to note that.

    to force /tmp clearing at boot, and following a long ago seen post, i
    set my fstab to:

    none /tmp tmpfs auto,nodev,noexec,noatime 0 0

    *without* your size limits...how does it know how much RAM it can
    use...or, can it FILL the RAM???

    hmmmm, it has been running for months like that (rebooting after
    overnight shutdown to conserve energy)...should/must i change to
    caf4926's way???

    --
    Andy Sipowicz

  7. #7

    Default Re: Clear Temp Files at Boot

    Quote Originally Posted by Andy Sipowicz View Post
    *without* your size limits...how does it know how much RAM it can
    use...or, can it FILL the RAM???
    Read "man mount" (search for tmpfs if you don't want to read all of it).

  8. #8
    Join Date
    Jun 2008
    Location
    The English Lake District. UK - GMT/BST
    Posts
    36,729
    Blog Entries
    20

    Default Re: Clear Temp Files at Boot

    Some data is saved to /tmp
    ie; say you copy a dvd and create image only. the .iso is stored in /tmp/kde-*username
    With a default install that will stay there forever.

    I'm not sure have using /tmp to RAM would be affected by a .iso like that?

    I set mine to 1day
    But it seems users have different ideas.
    Leap 15.1_KDE
    My Articles Was I any help? If yes: Click the star below

  9. #9

    Default Re: Clear Temp Files at Boot

    does a tmpfs automatically run in RAM??

    Yes.

    *without* your size limits...how does it know how much RAM it can
    use...or, can it FILL the RAM???

    By default, it uses up to half.

    hmmmm, it has been running for months like that (rebooting after
    overnight shutdown to conserve energy)...should/must i change to
    caf4926's way???

    Do it any way you'd like.

  10. #10
    Join Date
    Jun 2008
    Location
    Mallow, Ireland
    Posts
    1,031
    Blog Entries
    1

    Default Re: Clear Temp Files at Boot

    I set this up 2 days ago and so far I have no problems other than a slightly longer boot time due to the files being removed and more disc space

    I had about 4 Gb of temporary files apparantly. Probably the last DVD I 'backed up' with K9copy.
    "To err is human... to really foul up requires the root password."

Page 1 of 3 123 LastLast

Tags for this Thread

Posting Permissions

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