![]() |
Logging via bash script
I've written a couple rather simple bash scripts to automate the updating of audio files. Anyway, I echo some output and append to a file.
My problem is that I make an entry every 5 minutes, and the files gets mighty huge after a while. How can I limit the file to three days, or X KB? |
with "cat log.file | sed 1d > log.file.temp" you create a duplicate of your log without the first line.
You could use it when the file is to big to remove the first lines. There could be more elegant solution other than calling "sed 1d" 10 times to remove the first 10 lines - look at the sed docu... checking if the file is too big should not be such a problem... you could also use "cat log.file | grep ^ -c" to return the number of lines in your file... Greetings, BlishBlash |
Quote:
|
Quote:
|
Quote:
|
Here's my reverse SSH script thus far:
Code:
#!/bin/bash |
Quote:
|
That seems kind of backward, but ooookay. Still somewhat better than the grep solution. :)
|
Quote:
|
| All times are GMT -5. The time now is 02:01 PM. |