Solaris / OpenSolarisThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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?
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.
Distribution: Solaris 10, Solaris Express Community Edition
Posts: 547
Rep:
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.