-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Fabien Carmagnac wrote: > Hello,
Hi. Your question (and its potential solution) isn't really topical for this forum (which is for discussion of the GNU coreutils software package). It involves the use of a part of that software (rm, and apparently bash), but it doesn't have much in particular to do with it. If you continue to have problems after the explanation and suggestion here, you should probably take it to a forum dedicated to support for your system. > I have a problem when I remove a file which is a redirection of the std > output of a process: > > I launch a process and redirect output to file: > [EMAIL PROTECTED] ./myprocess &> mylog.log > > Then (after a few days/weeks), I remove the mylog.log file, hoping the system > will create a new fresh one. > [EMAIL PROTECTED] rm -f mylog.log > > But the system never created again the file. Why would the system create a fresh one? You asked it to get rid of it. > After a few days, df gives 100% disk used but kdirstat (a gui tool to watch > size of each folder recursivly), says 20%used. The process is still writing to the file, even though it doesn't have a directory entry ("link") anywhere. So long as a process has it open, a file exists until both the processes that have it open are terminated, _and_ it no longer has any links in the filesystem. > Then, if I reboot, df says 20%used also. > > So my question is : is there a way to rotate/remove/resize logs without: > - reboot computer > - stop process flishing in it Nope. What I'd suggest is have the process's output pipe to a program whose responsibility is to read a line, open the log file, append the line to it, then close it. Something like: #!/bin/sh set -u : "$1" IFS= while read -r LINE do echo "$LINE" >> "$1" done Then you would run ./myprocess | /path/to/script mylog.log Removing or rotating the mylog.log file would then still permit the next line to appear in a new mylog.log. - -- Micah J. Cowan Programmer, musician, typesetting enthusiast, gamer. GNU Maintainer: wget, screen, teseq http://micah.cowan.name/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIl6/s7M8hyUobTrERAgZXAJ4mOsaaldPmHjdCYz6TqbcSeEfxOQCdE0/n jkhX9PY1ndlVdUexphemVVo= =75Oe -----END PGP SIGNATURE----- _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils