LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 12-25-2008, 08:58 AM   #1
Yeung
LQ Newbie
 
Registered: Jan 2008
Posts: 5

Rep: Reputation: 0
Lightbulb Files in /tmp directory


Hi,

I want to write a cron script to clean up files older than 10 days in the /tmp directory of a Solaris 10 machine. But I always find strange files in this directory like ".ICE-unix", ".X11-pipe","rootswup.trc"....etc. I am wondering if there are system files in this directory that shouldn't be removed. I am worrying the system might be in trouble if any of these files missed. Is there a check list telling which files should be kept in this directory? Thank you.

Rgds,
Yeung
 
Old 12-25-2008, 04:34 PM   #2
geek745
Member
 
Registered: Jul 2004
Location: Alton, IL
Distribution: Linux Mint; Slackware; Ubuntu; Slax
Posts: 172
Blog Entries: 2

Rep: Reputation: 34
tmp means temporary - that doesn't necessarily mean expired. sometimes files, especially those that are hidden, are currently in use by a program. try running stat on them to see if they've been accessed since you last logged in. If they're left over from a previous session, I would say it's safe to delete them.
 
Old 12-30-2008, 10:43 AM   #3
popowich
Member
 
Registered: Nov 2004
Location: Rochester, New York
Distribution: RHEL7
Posts: 53

Rep: Reputation: 15
Hello,

I'm curious why you are looking to do this? Is there a problem that you are trying to solve? Solaris will clear this space on reboots, not that you should need to do reboots often except for installing patches and such. Do you have a program using /tmp that might be better off using another path for it's temp files?

-Raymond
 
Old 12-31-2008, 03:00 AM   #4
Yeung
LQ Newbie
 
Registered: Jan 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by popowich View Post
Hello,

I'm curious why you are looking to do this? Is there a problem that you are trying to solve? Solaris will clear this space on reboots, not that you should need to do reboots often except for installing patches and such. Do you have a program using /tmp that might be better off using another path for it's temp files?

-Raymond
My clients run scientific simulations in the machine. These programs generate huge transient files in sub-directories in /tmp. If /tmp gets too small, the simulation programs might hang. There are many clients, each with very long simulation jobs often in multiple days. Rebooting the machine frequently to clean /tmp is not practical, so I want to clean the /tmp daily with a cron job.

Yeung
 
Old 01-01-2009, 07:10 AM   #5
crisostomo_enrico
Member
 
Registered: Dec 2005
Location: Madrid
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547

Rep: Reputation: 36
It sounds like these simulations are not properly cleaning up the temporary space they use during their jobs.

The first thing I'd do, if it's possible, would be having these processes using a known set of subdirectories below /tmp instead of trying to understand when and which system process could use a file you could find under /tmp: that approach doesn't seem so solid to me. Once you have this directory enumeration you could write a script which uses the fuser command to determine if a process is using a file or a directory some way and if not, delete it. See fuser man page for more details.

You could also use other parameters to filter out the files you're looking for, such as the last access time. Approaches may also depend on how quickly you're running out of space on /tmp. By the way, I'm not sure I would run such a task once a day. If the script you write is performing well you could plan its execution more times per day to go cleaning up stale files more often.

Last edited by crisostomo_enrico; 01-01-2009 at 07:20 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/TMP Directory carlosinfl Linux - General 4 01-23-2007 01:02 PM
how to list all the files in /tmp directory that have been created or changed. y2k6summi Linux - General 1 03-29-2006 10:21 AM
/tmp/ directory and Instlation files sckain Linux - Newbie 1 05-03-2004 09:20 PM
Numerous scb_*.tmp files in /tmp dburk Programming 3 08-18-2003 04:28 PM
/tmp directory Bobmeister Linux - General 3 06-01-2003 04:32 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 08:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration