chore: migrate backup scheduled mode from linux cron to go cron

This commit is contained in:
Jonas Kaninda
2024-09-28 09:20:35 +02:00
parent 7475e35bd3
commit e4d2d69fa0
9 changed files with 145 additions and 110 deletions

View File

@@ -10,6 +10,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"github.com/robfig/cron/v3"
"github.com/spf13/cobra"
"io"
"io/fs"
@@ -248,3 +249,7 @@ func getTgUrl() string {
return fmt.Sprintf("https://api.telegram.org/bot%s", os.Getenv("TG_TOKEN"))
}
func IsValidCronExpression(cronExpr string) bool {
_, err := cron.ParseStandard(cronExpr)
return err == nil
}