test cron

This commit is contained in:
shoopea
2023-07-31 18:11:29 +02:00
parent f51d7f4f51
commit ca3d8177bd
8 changed files with 196 additions and 95 deletions

View File

@@ -51,22 +51,12 @@ func main() {
}
if *isDaemon {
cfg.Start(nil)
server := NewServer(cfg.Admin.Addr, cfg.Admin.Username, cfg.Admin.Password)
server.Run()
} else {
e := NewEmail(time.Now())
cfg.Start(e)
defer cfg.Stop(e)
cfg.Run(e)
cfg.Cleanup(e)
if err := e.Send(); err != nil {
log.Printf("Cannot send email (%s)", err)
if cfg.Admin == nil {
cfg.Admin = NewAdmin()
}
cfg.Admin.Run()
} else {
cfg.Run()
os.Exit(0)
}