Skip to content

Instantly share code, notes, and snippets.

@andelf
Created June 29, 2013 05:25

Revisions

  1. andelf created this gist Jun 29, 2013.
    25 changes: 25 additions & 0 deletions sighup.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    // program
    package main

    import "os/signal"
    import "os"
    import "fmt"
    import "syscall"
    import "time"


    func main() {
    c := make(chan os.Signal, 1)
    signal.Notify(c, syscall.SIGHUP)

    go func(){
    for sig := range c {
    println(sig)
    fmt.Printf("Got A HUP Signal! Now Reloading Conf....\n")
    }
    }()
    for {
    time.Sleep(1000 * time.Millisecond)
    fmt.Printf(">>")
    }
    }