Sponsored Content
Top Forums Shell Programming and Scripting I need to make a script to delete files not in use in /tmp Post 302434707 by Scrutinizer on Monday 5th of July 2010 01:29:43 AM
Old 07-05-2010
It is not advisable to remove files that have only recently been accessed as it is no guarantee that they are not actually still being used by a process. A 100% safe way is to clean /tmp (and /var/tmp) at boot time. One could use a compromise and determine an age at which a tmp file is deemed no longer in use. Best is to use the standard cleanup scripts that come with most OS'es as an init.d script these days....
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

monitoring /tmp and /var/tmp for suspicous activity

Hello, does anyone have a script that can check the contents of the /tmp directory and for example e-mail the directory content if anything other than session files are present? Maybe there are better ways to monitor suspicous /tmp and /var/tmp activity, if so I'm listening :) (1 Reply)
Discussion started by: jamesbond
1 Replies

2. Solaris

Auto delete files in /tmp dir ???

I have a Solris 9 box my problem is when I restart my box all my files and dirs in /tmp dir will be deleted exept 2 directories I found them since installation phase !!!! How to keep my files at that dir " /tmp " even after restarting ??? (1 Reply)
Discussion started by: DarkSoul
1 Replies

3. Shell Programming and Scripting

Make script delete certain files

Hi, In a directory, say ~/dir is a lot of files and subdirectories. Some of the files are named res1.om res2.om ... res65.om The amount of files varies. I need a .csh script that deletes all res*.om files except the one with the highest number. Any suggestions? Thanks in... (6 Replies)
Discussion started by: pederlol
6 Replies

4. Linux

/var/tmp/slapd.log.swp delete?

Hi All, Can I delete the above file? It's big, about 1G. It's on a redhat ent 4 with ldap on it. Is that safe to delete? It wasn't been used for already a month and it's in the backup storage. Thanks for any comment you may add. (1 Reply)
Discussion started by: itik
1 Replies

5. Shell Programming and Scripting

Script for delete tmp files older than 15 days and owned by "xxx" id

Hi All , I want to delete files from /tmp directory created by "xxxx" id. because i got the list says more than 60 thousand files were created by "xxxx" id since 2002. The /tmp directory has lot of files created by different user ids like root,system etc.. But, i need a script to... (2 Replies)
Discussion started by: vparunkumar
2 Replies

6. Shell Programming and Scripting

Need script to remove millions of tmp files in /html/cache/ directory

Hello, I just saw that on my vps (centOS) my oscommerce with a seo script has created millions of tmp files inside the /html/cache/ directory. I would need to remove all those files (millions), I tried via shell but the vps loads goes to very high and it hangs, is there some way to do a... (7 Replies)
Discussion started by: andymc1
7 Replies

7. Shell Programming and Scripting

Need help creating a script to FTP files to a server and then delete the files that were transfered.

I am trying to FTP files to a Windows server through my Linux machine. I have setup the file transfer with no problems but am having problem deleting those files from the Linux box. My current non-working solution is below. Any ideas, anyone?? :wall: Please be gentle, I'm fairly new to this... (4 Replies)
Discussion started by: jmalfhs
4 Replies

8. AIX

[Solved] Not able to delete/create file in /tmp

This is AIX box and I am not able to create or delete file in /tmp though space is there root@ttcols01/ #touch /tmp/test_file touch: 0652-046 Cannot create /tmp/test_file. root@ttcols01/ #mkdir /tmp/test_dir mkdir: 0653-358 Cannot create /tmp/test_dir. /tmp/test_dir: Invalid file system... (9 Replies)
Discussion started by: solaris_1977
9 Replies

9. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

10. Shell Programming and Scripting

Shell script to find the GB files in /tmp directory in remote server

Hi, i need help on shell scripting. Main intention of the script is step 1: ssh to remote server Step 2: cd /tmp in remote server Step 3: in tmp i want to grep only files and directories which are in GB sizes All the servers list file is - tmpsrv.txt vi tmpsrv.txt ... (17 Replies)
Discussion started by: kumar85shiv
17 Replies
VIRECOVER(8)						    BSD System Manager's Manual 					      VIRECOVER(8)

NAME
virecover -- report recovered vi edit sessions SYNOPSIS
/usr/libexec/virecover DESCRIPTION
The virecover utility sends emails to users who have vi(1) recovery files. This email gives the name of the file that was saved for recovery and instructions for recovering most, if not all, of the changes to the file. This is done by using the -r option with vi(1). See the -r option in vi(1) for details. If the backup files have the execute bit set or are zero length, then they have not been modified, so virecover deletes them to clean up. virecover also removes recovery files that are corrupted, zero length, or do not have a corresponding backup file. virecover is normally run automatically at boot time using /etc/rc.d/virecover. FILES
/var/tmp/vi.recover/recover.* vi(1) recovery files /var/tmp/vi.recover/vi.* vi(1) editor backup files SEE ALSO
vi(1), rc.conf(5) HISTORY
This script, previously known as recover.script, is from nvi and was added to NetBSD in 1996. It was renamed in 2001. AUTHORS
This man page was written by Jeremy C. Reed <reed@reedmedia.net>. BSD
October 9, 2006 BSD
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy