Open vi7Ch opened 5 years ago
I think you can do gocron.Every(1).Day().At("8:00").Do(task_start) to start the task
gocron.Every(1).Day().At("18:30").Do(task_stop) to stop the task
I think you can do gocron.Every(1).Day().At("8:00").Do(task_start) to start the task
gocron.Every(1).Day().At("18:30").Do(task_stop) to stop the task
LGTM, prefect!
I think you can do gocron.Every(1).Day().At("8:00").Do(task_start) to start the task
gocron.Every(1).Day().At("18:30").Do(task_stop) to stop the task
How to run it Every 5 Minutes? It only run once at 8:00?
Expanding on the example - this works:
package main
import (
"log"
"github.com/jasonlvhit/gocron"
)
func task() {
log.Println("I am runnning task.")
}
func task_start() {
log.Println("Starting the task.")
gocron.Every(5).Minutes().From(gocron.NextTick()).Do(task)
}
func task_stop() {
log.Println("Stopping the task.")
gocron.Remove(task)
}
func main() {
gocron.Every(1).Day().At("08:00").Do(task_start)
gocron.Every(1).Day().At("18:30").Do(task_stop)
<-gocron.Start()
}
@JohnRoesler Perfect! thanks.
Hi,
Do you know whether it would be possible to include a from HH:MM till HH:MM feature ? Let's say I want to schedule a task every 5MIN from Monday to Friday, from 8:00 till 18:30.
maybe with a
gocron.Clear()
<- gocron.Start()
That would be a good feature if it is currently not possible.
Any idea ?
Thanks,