Shutdown
Shutdown the application with a signal.
Install & Build
go get github.com/lishimeng/go-libs/shutdown.git
Usage
package main
import (
"fmt"
"github.com/lishimeng/go-libs/shutdown"
"time"
)
func main() {
go work()
shutdown.WaitExit(&shutdown.Configuration{
BeforeExit: func(s string) {
fmt.Printf("Shutdown %s\n", s)
},
})
}
func work() {
for{
time.Sleep(time.Second * 3)
fmt.Println("work....")
}
}