KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have the following issue: I have an application, which continuously produces output to stderr and stdout. The output of this application is captured in a logfile (the app is redirected as: &> log.txt ). I don't have any options to produce a proper logging to file for this. Now, I have a cron job, which runs every hour and beside of doing other things, it also tries to rotate this logfile above, by copying it to log.txt.1 and then creates an empty file and copies it to log.txt It looks like: cp log.txt log.txt.1 touch /tmp/empty cp /tmp/empty log.txt The problem is, that the application is still writing to it, and because of this I get some very strange stuff in the log.txt.1, it starts with a lot of garbage characters, and the actual log file is somewhere at the end. Do you have any idea, how to make a correct log rotating for this specific situation (I also tried cat log.txt > log.txt.1 , does not work)? Using logrotate for this specific application not an option, there is a whole mechanism behind the scenes that I may not change. Thanks, f.
Tags (comma-separated)
Save Edits
Cancel