31 lines
482 B
Go
31 lines
482 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"os"
|
||
|
"os/signal"
|
||
|
"syscall"
|
||
|
|
||
|
"code.jhot.me/jhot/docker-s3-backup/cmd"
|
||
|
"code.jhot.me/jhot/docker-s3-backup/internal"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
ctx context.Context
|
||
|
cancel context.CancelFunc
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
ctx, cancel = context.WithCancel(context.Background())
|
||
|
|
||
|
go func() {
|
||
|
sigch := make(chan os.Signal, 1)
|
||
|
signal.Notify(sigch, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM)
|
||
|
<-sigch
|
||
|
internal.StopSchedule()
|
||
|
cancel()
|
||
|
}()
|
||
|
|
||
|
cmd.Execute(ctx)
|
||
|
}
|