cron
cron copied to clipboard
Multiple executions of scheduled function when laptop is waked up
Hello! It seems that I ran into the opposite of https://github.com/robfig/cron/issues/154. I use cron in the program that starts shell scripts on a schedule. Sometimes the program remains in the background and I close the laptop. Several hours later, after the night, the laptop is waked up and the CPU is overloaded because thousands of shell scripts are started %)
The system is Ubuntu 16.04 and the code is like this:
initialization code:
entryId, _ := sm.cron.AddFunc(newEntry.Crontab, func() {
logEntry.Debugf("fire schedule event for entry '%s'", newEntry.Crontab)
ScheduleCh <- newEntry.Crontab
})
go routine:
select {
case ev := <-ScheduleCh:
scripts[ev.Crontab].Start()
...
}
Do you have any idea why cron can execute the callback multiple times after time changes?
I'm not sure, but I would like to figure it out and solve this..