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

service restart like systemd timer or crontab after specific time period in seconds. #115

Open
osevan opened this issue Oct 10, 2022 · 2 comments
Labels
C-dinit-service Things about dinit-service

Comments

@osevan
Copy link

osevan commented Oct 10, 2022

We need additonaly infinity loop for some services like own created daemons or scripts to start after 5 seconds for example.

I hope any plans for this kind of service are in todo list

Thanks and

Best regards

@mobin-2008 mobin-2008 added C-dinit-service Things about dinit-service Feature Request Request a feature to be added to dinit labels Oct 10, 2022
@mobin-2008
Copy link
Collaborator

Hi!
About this issue, I think that using cron is the best solution. I think it is possible to define in crontab that the service restarts every 5 seconds through dinitctl, isn't this enough? Maybe I didn't understand what you mean?!

@mobin-2008 mobin-2008 removed the Feature Request Request a feature to be added to dinit label Oct 10, 2022
@q66
Copy link
Sponsor Contributor

q66 commented Apr 5, 2023

i'm thinking of working on timers next

my idea is roughly something like this:

there would be separate timer services, with special options, but otherwise still treated like a service as in they could have dependencies and ordering hints like before = and so on; something depending on a timer unit would result in the timer service being considered "ready" immediately

an example would be something like this perhaps:

foo.timer:

type = timer
on-startup = 180 # monotonic: do not trigger unless at least 3 minutes have elapsed since dinit has started
on-active = 60 # monotonic: trigger 60 seconds after something has activated the timer unit
on-calendar = ... some syntax to specify the period ... # wallclock
trigger = some-other-service # the service to activate; perhaps mean an implicit `before =` link for this service too?
restart = true # if false, do nothing to triggered service if it's already running; if true, restart it?

some-other-service:

type = scripted
command = whatever
stop-command = whatever

but i'm not sure if/when i'll be able to get to it, plus i'm not quite sure if this design would work

it is technically possible to get timers already a bit clunkily by using https://github.com/leahneukirchen/snooze together with auto-restart, but it is not the most convenient to work with, and some things are outright impossible to do correctly (e.g. how do you say "i want to run this every day at midnight" but also "i don't want the first iteration to begin unless at least 10 minutes has elapsed since boot")

stuff like cron is even worse to work with, and perhaps even more limited because it does not integrate with service supervision at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-dinit-service Things about dinit-service
Projects
None yet
Development

No branches or pull requests

3 participants