I am trying to redirect program output continuously to a file, say error_log.
The command I use looks like this: it myprogram.shworks continuously, generating data and writing to/var/log/httpd/error_log
myprogram.sh >> /var/log/httpd/error_log
Now I use logrotateto rotate this file per hour. I use the command createin logrotateto rename the original file and create a new one. Configuration logrotatelooks like
/var/log/httpd/error_log {
create
rotate 4
dateext
missingok
ifempty
.
.
.
}
But the redirection is reassigned. I want to myprogram.shwrite data to a file error_logno matter what it rotates with logrotate, obviously for a newly created fileerror_log
, ?
bash?