Skip to content

koron-go/hupfile

Repository files navigation

koron-go/hupfile

PkgGoDev Actions/Go Go Report Card

hupfile is a SIGHUP aware output only file which implement io.WriteCloser. When did it accepts SIGHUP, it reopen an underlying file. This is intended to use with logrotate.

hupredir command

hupredir command reads from STDIN and write to a file. And it accepts SIGHUP then reopen the file. It makes your command support log rotation easily.

How to start hupredir:

$ your-cmd-output-stdout | hupredir -out my.log -pid my.pid &

How to rotate log:

$ mv my.log my.log.1
$ kill -HUP `cat my.pid`

How to install and update hupredir:

$ go install github.com/koron-go/hupfile/cmd/hupredir@latest

About

SIGHUP aware os.File writer

Resources

License

Stars

Watchers

Forks

Packages

No packages published