-
-
Save parzibyte/5ad7cdcd2e649667c0810d4ce1a863a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
err := crearTablas() | |
if err != nil { | |
log.Printf("Error creando tablas: %v", err) | |
return | |
} | |
c := cron.New() | |
defer c.Stop() | |
// Agregarle funciones... | |
// Ejecutar cada segundo toda la vida | |
err = c.AddFunc("0 */1 * * *", func() { | |
log.Printf("Soy cron") | |
revisarGistYCambiarImagenSiEsNecesario() | |
}) | |
if err != nil { | |
log.Printf("Error iniciando cron: %v", err) | |
return | |
} | |
// Comenzar | |
c.Start() | |
// Lo siguiente es únicamente para pausar el programa y no tiene nada | |
// que ver con cron o el ejemplo, recuerda que | |
// el programa se detiene con Ctrl + C | |
select {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment