The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > Linux
Google UNIX.COM


Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
crone job implimentation Ramesh Vellanki Shell Programming and Scripting 1 07-03-2008 12:33 AM
delete files older than 5 minutes in directory (recursively) scarfake Shell Programming and Scripting 3 06-12-2008 10:10 PM
users who loged within 5 minutes roshni Shell Programming and Scripting 3 07-04-2007 06:35 AM
get last 5 minutes' log from log file? fedora Shell Programming and Scripting 5 07-19-2006 01:49 PM
Convert minutes to hours, minutes, seconds Vozx Shell Programming and Scripting 1 12-08-2005 10:24 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-01-2008
Registered User
 

Join Date: Aug 2008
Posts: 1
Crone job to delete .txt every few minutes

How can I setup a cron job to delete a .txt file in a directory every 'x' minutes?

After the file is deleted, the poll script automatically builds the file again if it's not their.

What would the code look like to do this?

Any help and consideration is greatly appreciated.
Reply With Quote
Forum Sponsor
  #2  
Old 08-01-2008
Registered User
 

Join Date: Aug 2008
Posts: 3
*/5 * * * * rm /home/someuser/tmp.txt should rm the file every 5 minutes.

I am very new to this, so get a second opinion before listening to anything that falls out of my face, I've been known to be WAY off.
Reply With Quote
  #3  
Old 08-04-2008
broli's Avatar
Registered User
 

Join Date: Dec 2007
Location: Argentina
Posts: 198
you can also use
0-59/5 * * * * rm /home/someuser/tmp.txt
or
5 10 15 20 25 30 35 40 45 50 55 * * * * rm /home/someuser/tmp.txt

(i had to learn this by force on an old AIX :P )
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0