test email

This commit is contained in:
shoopea
2022-06-19 12:12:00 +08:00
parent 86ddd52642
commit 493715555d
3 changed files with 23 additions and 12 deletions
+14 -8
View File
@@ -9,14 +9,15 @@ import (
)
var (
appFlag = flag.String("app", "", "run specific app")
cfgFile = flag.String("config", "config.json", "config file")
schedFlag = flag.String("schedule", "", "specific schedule")
slowFlag = flag.Bool("slow", false, "slow process")
testFlag = flag.Bool("test", false, "test run")
debugFlag = flag.Bool("debug", false, "debug")
cfg Config
email *Email
appFlag = flag.String("app", "", "run specific app")
cfgFile = flag.String("config", "config.json", "config file")
schedFlag = flag.String("schedule", "", "specific schedule")
slowFlag = flag.Bool("slow", false, "slow process")
testFlag = flag.Bool("test", false, "test run")
debugFlag = flag.Bool("debug", false, "debug")
testMailFlag = flag.Bool("test-mail", false, "test email setup")
cfg Config
email *Email
)
func main() {
@@ -34,6 +35,11 @@ func main() {
os.Exit(1)
}
if *testMailFlag {
SendMail(cfg.Email.smtpHost, cfg.Email.fromEmail, "test backup email topic", "test backup email body", cfg.Email.toEmail)
os.Exit(0)
}
err = RunBackup(*appFlag)
if err != nil {
log.Printf("Cannot run schedule (%s)", err)