Crone job to delete .txt every few minutes


 
Thread Tools Search this Thread
Operating Systems Linux Crone job to delete .txt every few minutes
# 1  
Old 08-01-2008
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.
# 2  
Old 08-01-2008
*/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.
# 3  
Old 08-04-2008
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 )
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Delete files in a txt file

Hi, I have very old files in my server like from 2012 and i want to delete them, Please help. Thanks in advance.. (2 Replies)
Discussion started by: nanz143
2 Replies

2. Shell Programming and Scripting

Cron Job to Run every 2 minutes

Hello Gurus, I want to schedule a cron job which will run every 2 minutes starts at 11:25 AM and 3:25 AM daily. Can you please suggest as how to schedule the job. Thanks- Pokhraj Das (2 Replies)
Discussion started by: pokhraj_d
2 Replies

3. Shell Programming and Scripting

Cron Job to Run for 30 minutes

Hello Gurus, I have a requirement to run a job from cron only for 30 minutes duration daily twice at 8.35 am and 20.35 pm Can you please suggest how to schedule the job? Thanks- Pokhraj (5 Replies)
Discussion started by: pokhraj_d
5 Replies

4. Shell Programming and Scripting

Delete file2.txt from file1.txt using scripting

Hi, I`m a total newbie, well my requirement is that i have 2 files I want to identify which countries i do not currently have in db.. how can i use the grep or another command to find this file .. i want to match all-countries.txt with countries-in-db.txt so the output is equal to... (11 Replies)
Discussion started by: beanbaby
11 Replies

5. Solaris

How to setup a cron job to run every 45 minutes in Solaris 5.10

How to setup a cron job to run every 45 minutes in Solaris 5.10 (9 Replies)
Discussion started by: reyazan
9 Replies

6. Homework & Coursework Questions

Delete first both lines from .txt

Hi, I have to programming a program in shell script which combine a lot of .txt files. But in all of these files the program had to delete the first both lines. Because I don't know anything about shell script I need your help. Does anyone have a command or a hint, where I can look for? ... (1 Reply)
Discussion started by: mkrol
1 Replies

7. Shell Programming and Scripting

Delete first and second lines from .txt

Hi, I have to programming a program in shell script which combine a lot of .txt files. But in all of these files the program had to delete the first both lines. Because I don't know anything about shell script I need your help. Does anyone have a command or a hint, where I can look for? ... (1 Reply)
Discussion started by: mkrol
1 Replies

8. Shell Programming and Scripting

Cron job for every five minutes and between hours

Hi I need to run a script every five minutes and it should run between 07-15 hours all days. How i can achieve this... i tried like this */5 07-15 * * * /scripts/CreateFtpData.sh It throws an error... (1 Reply)
Discussion started by: aemunathan
1 Replies

9. Shell Programming and Scripting

crone job implimentation

I wanted to enable one shell script in the cronetab,how to do crone tabe enabling pl help me:( regards, ramesh (1 Reply)
Discussion started by: Ramesh Vellanki
1 Replies

10. Shell Programming and Scripting

delete files older than 5 minutes in directory (recursively)

sorry guys can some please give me a hint how to achieve this in a slick oneliner? delete files older than 5 minutes in specified directory (recursively) peace (3 Replies)
Discussion started by: scarfake
3 Replies
Login or Register to Ask a Question