backup-notify/scheduler/scheduler.go

18 lines
331 B
Go
Raw Normal View History

2024-04-21 21:46:40 -04:00
package scheduler
import (
"database/sql"
"time"
"git.simponic.xyz/simponic/backup-notify/database"
"github.com/go-co-op/gocron"
)
func StartScheduler(dbConn *sql.DB) {
scheduler := gocron.NewScheduler(time.Local)
2024-04-21 21:49:41 -04:00
scheduler.Every(1).Hour().Do(func() {
2024-04-21 21:46:40 -04:00
database.DeleteOldBackups(dbConn, 31)
})
scheduler.StartAsync()
}