Return to BSD News archive
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!olivea!uunet!sci34hub!gary From: gary@sci34hub.sci.com (Gary Heston) Newsgroups: comp.os.386bsd.questions Subject: Re: Rotating the syslogs Message-ID: <1993Apr2.030028.4032@sci34hub.sci.com> Date: 2 Apr 93 03:00:28 GMT References: <1p77tt$rq3@usenet.INS.CWRU.Edu> <1993Mar30.194840.5890@sci34hub.sci.com> <1993Mar31.161718.4449@dsuvax.dsu.edu> Reply-To: gary@sci34hub.sci.com (Gary Heston) Organization: SCI Systems, Inc., Huntsville, Al. Lines: 35 In article <1993Mar31.161718.4449@dsuvax.dsu.edu> ghelmer@dsuvax.dsu.edu (Guy Helmer) writes: |In <1993Mar30.194840.5890@sci34hub.sci.com> gary@sci34hub.sci.com (Gary Heston) writes: | |>In article <1p77tt$rq3@usenet.INS.CWRU.Edu> david@jake.EEAP.CWRU.Edu (David Nerenberg) writes: |>>I am trying to rotate my syslogs from cron. The cron side of things |>>is fine. Fir example, I move messages to messages.OLD and touch a |>>new messages file. |>Don't. Copy messages to messages.OLD, then copy /dev/null into messages. | |>This leaves the permissions, ownership, and inode number of the messages |>file intact; once copied, you can move messages.OLD any way you want |>without problems. |Doesn't that leave an opportunity to lose messages between the two copy |commands, though? Yes, it does. However, the chance is fairly small, and it's the best method I've come up with. The window of possible error is between the end of the cp messages messages.OLD and the cp /dev/null messages command. (Anything added while the first cp is in process should be copied.) The cp command should still be in a buffer after the file is copied, so it would be fairly fast when executing the second--which also has very little to do. It might be even faster to use a redirect from within the shell (something like ">messages") to zero the file. The only alternative I know of would be to shut the system down to single- user before dealing with the files, which is pretty inconvenient. -- Gary Heston SCI Systems, Inc. gary@sci34hub.sci.com site admin The Chairman of the Board and the CFO speak for SCI. I'm neither. Remember: A majority of the American people voted against *all* of the Presidential Candidates. How encouraging....