|
@ -4,7 +4,10 @@ import ( |
|
|
"XProxy/cmd/common" |
|
|
"XProxy/cmd/common" |
|
|
"github.com/robfig/cron" |
|
|
"github.com/robfig/cron" |
|
|
log "github.com/sirupsen/logrus" |
|
|
log "github.com/sirupsen/logrus" |
|
|
|
|
|
"os" |
|
|
|
|
|
"os/signal" |
|
|
"path" |
|
|
"path" |
|
|
|
|
|
"syscall" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
type Config struct { |
|
|
type Config struct { |
|
@ -42,4 +45,13 @@ func AutoUpdate(config *Config, assetDir string) { // set cron task for auto upd |
|
|
}) |
|
|
}) |
|
|
autoUpdate.Start() |
|
|
autoUpdate.Start() |
|
|
} |
|
|
} |
|
|
|
|
|
updateChan := make(chan os.Signal, 1) |
|
|
|
|
|
go func() { |
|
|
|
|
|
for { |
|
|
|
|
|
<-updateChan |
|
|
|
|
|
log.Infof("Receive SIGALRM -> update assets") |
|
|
|
|
|
updateAsset(config.Update.Url, assetDir, config.Update.Proxy) |
|
|
|
|
|
} |
|
|
|
|
|
}() |
|
|
|
|
|
signal.Notify(updateChan, syscall.SIGALRM) |
|
|
} |
|
|
} |
|
|