Yes you can. However, I wouldnt just put in an "rm" command. I would write a small script that checks for the existance of the file and if found, delete it.
Cron entry would look something like this:
0,30 * * * * /some/path/to/script
and the (really simple, no error checking or anything) script would look something like this:
Might want to touch the file afterwards, to create an empty file just in case anything relies on it being there...
Steve
[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object:erlDesignPatterns)[/small]
[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object:erlDesignPatterns)[/small]
so I take this and put it in the from in cron or put in a file (script) and so how excute the file (script) from cron? again sorry new to this first time useing cron. to me cron seems like a bin or autoecex file that I used in windows, I may be wrong but trying to learn.
MA WarGod
I believe if someone can think it, it can be programmed
No, cron is like the Windows Scheduler, it runs commands at certain times.
If you just want to create a script that you can execute manually, all you need to do is create a plain text file containing the commands, and then make it executable using chmod u+x filename.
Then you type /full/path/to/filename to run it, or just filename if it is located somewhere in your PATH.
ok so its kinda like a bin file I am starting to understand so I can set the "cmd" or "CD' to run in the times I wish
see I have a room log file and say every 30 min's I wish it to be delete as per I don't wish all the data within the log to be loaded within the room (when some come in)
this will make the load times better and tranfer rate better I beleive.
thanks
MA WarGod
I believe if someone can think it, it can be programmed
For that sort of thing you should probably use logrotate, which is designed for managing logs like this.
If you just create a file /etc/logrotate.d/mylog containing a rule like:
[tt]/path/to/mylog {
rotate 7
daily
}[/tt]
It will rotate the log file once a day, keeping 7 days worth. The previous day's log will be called /path/to/mylog.1, the day before that /path/to/mylog.2, etc.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.