-
Notifications
You must be signed in to change notification settings - Fork 1
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
Cron jobs #69
base: master
Are you sure you want to change the base?
Cron jobs #69
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @maximevanhees for this PR. But I left few "questions" of things that should be taken care of.
In general. I don't fully agree that cron jobs should be implemented in zinit this way due to the following points:
- Zinit is a process manager. This unnecessary complicate the state machine of zinit.
- Service dependency. What happens if another service is depending on a oneshot service that has cron ?
- My major concern of what happens when:
- You start a service (that has cron)
- You then decide to stop and forget it
- You monitor it again with new cron schedule
Again embedding cron in zinit this way makes it hard to answer those questions this is why I suggest the following:
implement a completely separate zinit cron
service that can understand /etc/crontab
file
That is a normal daemon that can read this file, and run jobs as scheduled in this file https://linux.die.net/man/5/crontab
When zinit start. it auto start zinit cron
(without configuration) and this service canb't be managed by external zinit commands (so you can't stop it or restart it)
This way we take the cron outside of zinit state machine and at the same time it's natively supported by it. It also avoids the dependency problem since cron tasks are completely external tasks that are managed by zinit itself but rather by zinit cron
same way as crond
Note: this is just a proposal, feel free to ignore it if it's required that cron is configured per service as you did.
What exactly is your concern here? When a service is stopped and forgotten it becomes completely unrelated to monitoring it again (even with a new cron schedule). |
I've spoken with KDS about it and he is adamant that we should keep it as one single process and thus not create a separate |
The ability to create a cron job by specifying the
cron
flag in the<service>.yaml
file.cron
field syntax is:sec min hour day_of_month month day_of_week year
Example
hello.yaml
(runs every 5th second of each minute):Start (as default):
zinit monitor hello
Closes #66