cron icon indicating copy to clipboard operation
cron copied to clipboard

How to know if a job is running?

Open mghifariyusuf opened this issue 5 years ago • 3 comments

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

mghifariyusuf avatar Jul 13 '20 09:07 mghifariyusuf

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

zishiguo avatar Aug 23 '20 03:08 zishiguo

@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.

buildscientist avatar Nov 02 '20 05:11 buildscientist