Skip to content

How do I check the Next Run of a Job on the Scheduler? #246

Answered by JohnRoesler
vinicius507 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @vinicius507 you have the right idea here. I am wondering if something inside your code (the logger, or the task itself) is throwing that seg fault. I made a simple example showing the next run with that cron schedule and it prints out just fine:

func main() {
	sched := gocron.NewScheduler(time.Local)

	job, err := sched.Cron("* 18 ? * MON").Do(func() {})
	if err != nil {
		log.Fatal(err)
	}
	sched.StartAsync()
	log.Println(job.NextRun())
}

Have you tried running with a debugger to see where it's hitting that issue? Or just putting in some fmt.Println statements to see how far it's getting before hitting that seg fualt?``

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@vinicius507
Comment options

@JohnRoesler
Comment options

@vinicius507
Comment options

Answer selected by vinicius507
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants