- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Delete files from /tmp and /var/tmp
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 02:05 AM
тАО04-19-2002 02:05 AM
How to safely delete files from /tmp and /var/tmp ?
On my system are running Informix, Tuxedo, MQSeries.
Thx
KRI
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 02:13 AM
тАО04-19-2002 02:13 AM
Re: Delete files from /tmp and /var/tmp
See this similar thread:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x86a4ba808b46d611abda0090277a778c,00.html
C.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 02:14 AM
тАО04-19-2002 02:14 AM
Re: Delete files from /tmp and /var/tmp
Normal practise is to run a regular cron job (probably daily) that removes files older than a certain number of days.
For example, the following command will delete all files in /tmp that are more than 7 days old:-
find /tmp -type f -mtime +6 -exec rm -f {} \;
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 02:14 AM
тАО04-19-2002 02:14 AM
Re: Delete files from /tmp and /var/tmp
check for files still in use (don't delete them ofcourse) and the last acces time.
If files haven't been accessed for say 7 days, I would think it's safe to delete them.
It depends on what kind of files they are and on how much space you have avainlable.
if more space is available, delete them later.
Grt, E.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 02:15 AM
тАО04-19-2002 02:15 AM
Re: Delete files from /tmp and /var/tmp
Typically we run a script through cron which scan /tmp and /var/tmp for files older than 7 days. If these files are not in use, then delete them. There have been no complaints yets.
Hope this helps.
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 02:19 AM
тАО04-19-2002 02:19 AM
SolutionI would suggest that you remove files in /var/tmp or /tmp in an /sbin/rc1.d startup script.
Early during your system initialisation and startup, your applications are not launched yet, thus it would be safe to remove files in these directories. Thus I would suggest that you link your script in /sbin/rc1.d.
If you are to remove files in these directories while in run-level 3 or beyond, you may risk removing files that are still being opened by existing processes.
If you do not wish to wait for the next system startup, you can perform an fuser on the device mounted on by /tmp or /var/tmp to identify opened processes still using files in these directories. You can also use the lsof tool to provide finer granularity in identifying the processes currently using these directories. Subsequently, gracefully terminate these processes (only if not required) before removing the files.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 04:09 AM
тАО04-19-2002 04:09 AM
Re: Delete files from /tmp and /var/tmp
i just wonder... how often do you reboot the machine? I would go for a thorough analysis on what files come in these dirs and then create a cron job. Do as you think is best :-)
Grt, Emiel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 06:33 AM
тАО04-19-2002 06:33 AM
Re: Delete files from /tmp and /var/tmp
Regardless of whether you are removing files in /tmp during a system reboot (how conscientious are you in installing kernel patches?), automated cron job or manual deletion, the main point is to check that residing file(s) are not in use during the deletion of such file(s).
In my environment, /tmp and /var/tmp don't usually fill up that fast. As such, a periodic deletion (eg. 7 days)is an overkill for me. Apart from deletion during system reboot, a cron script monitors when either of /tmp or /var/tmp is >80% full. When that occurs, I get paged and files in /tmp are selectively and manually removed.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2002 06:50 AM
тАО04-19-2002 06:50 AM
Re: Delete files from /tmp and /var/tmp
I'm not sure that I'd agree with the need to check that temp files are in use.
The very fact that the 'modified date' is over a certain number of days old usually means that the file is not in use and even if a process still has the file open, deleting it doesn't affect that process. The file remains (unlinked and invisible) until it gets closed.
As others have stated, a startup script is fine but we now have very few servers that are regularly rebooted.
I prefer a cron'd daily housekeeping script which can be tailored to tidy other directories as well.
Regards,
John