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

Multiple executions of scheduled function when laptop is waked up #283

Open
diafour opened this issue Feb 6, 2020 · 1 comment
Open

Comments

@diafour
Copy link

diafour commented Feb 6, 2020

Hello! It seems that I ran into the opposite of #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?

@robfig
Copy link
Owner

robfig commented Apr 14, 2020

I'm not sure, but I would like to figure it out and solve this..

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

2 participants