LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   erase file (https://www.linuxquestions.org/questions/linux-general-1/erase-file-299965/)

ust 03-10-2005 06:59 AM

erase file
 
I have a file that always generated in the system eg. /tmp/log.txt , it is generated by the application program , but this file should not be present in the system otherwise there are some program problem , I want to erase this file once the program has generate it , as I know , it can link to /dev/null , could suggest how to make it


I use the s.link function , it is OK to link the file , but the /tmp/log.txt is exist , even the file can't be update but I really don't want the file exist in the system , how can I make the file don't appear in the system ( even the file size is 0 ) ? thx


/tmp/log.txt -- > /dev/null

Technoslave 03-10-2005 08:46 AM

Well, to erase the file, you'd do an rm /tmp/log.txt

You could do this as a cronjob, or via a shell script that is in cron that checks for the file.

To empty the file, you could do a > /tmp/log.txt

Same as above, either cron or shell script.


All times are GMT -5. The time now is 09:24 PM.