Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to know if a job is running? #326

Open
mghifariyusuf opened this issue Jul 13, 2020 · 2 comments
Open

How to know if a job is running? #326

mghifariyusuf opened this issue Jul 13, 2020 · 2 comments

Comments

@mghifariyusuf
Copy link

Hi, sorry to post it as an issue. I want to know if there is function to know if a job still running maybe by input it entry id? Or how do I check if a job is still running? Thank you

@zishiguo
Copy link

cron.New(
cron.WithLogger(
cron.VerbosePrintfLogger(log.New(os.Stdout, "cron: ", log.LstdFlags))))

@buildscientist
Copy link

@mghifariyusuf

Really depends on your goal here. Do you want to determine if this cron library has kicked off the job in its own goroutine or do you want to determine if the job actually ran/completed? The latter I believe is outside the scope of this library.

The former you can determine using comparisons between Entry.Prev/Entry.Next and time.Now().

For example if Entry.Prev has a 0 time value then you know that cron has never run the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants