i accidently zipped a log file of process (the process wasnt writing in it though, it writes it only during weekends when the process get killed).I unzipped the file immediately back. will it affect the process when it is trying to write in the log file?
migrated from stackoverflow.com Mar 19 '10 at 3:49
This question came from our site for professional and enthusiast programmers.
It depends on how the process manages the descriptor to the open log file.
If it keeps the descriptor open, then it will continue writing the old file. Even though you may have deleted the file and it is no longer in the file system directory, as long as the process keeps it open the file is still in the file system.
If the process reopens the file each time it needs to write, then it will write to your unzipped file.
My experience with logging subsystems is it is more common to keep the descriptor open. So I think it is less likely for the process to start writing the newly unzipped file.
Sometimes, when a process will reload it's configuration (and reopen it's log file) when you send it the proper signal. You should check the documentation and try that.
make use of a named pipe in unix
create a named pipe
mknod test.pipe p
read the pipe - output to zip file in the background
gzip < exp.pipe > your_operation/script