troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
632 stars 63 forks source link

service.c: set condition 'done' for oneshot tasks #207

Closed liuming50 closed 2 years ago

liuming50 commented 3 years ago

We like to know when a oneshot task is done, so as to start the services that depending on it, set a oneshot condition 'done' for that case.

Signed-off-by: Robert Andersson robert.m.andersson@atlascopco.com Signed-off-by: Ming Liu liu.ming50@gmail.com

troglobit commented 3 years ago

Interesting. It would be great if this also included an official way of accessing this information instead of poking around in the internals. Meaning, could you please add a way of inspecting this through initctl status foo as well?

Also, and possibly more importantly. A one-shot task per spec. runs once per runlevel it's allowed to run in, so when changing runelevel the task is run once again. Maybe this file should be removed for all tasks that are restarted?

liuming50 commented 3 years ago

Interesting. It would be great if this also included an official way of accessing this information instead of poking around in the internals. Meaning, could you please add a way of inspecting this through initctl status foo as well?

Also, and possibly more importantly. A one-shot task per spec. runs once per runlevel it's allowed to run in, so when changing runelevel the task is run once again. Maybe this file should be removed for all tasks that are restarted?

Thanks for the review, will rework a V2.

troglobit commented 2 years ago

Any progress on this? I'm gearing up for release 4.2 very soon ... :)

troglobit commented 2 years ago

Finit v4.2 was released during the weekend. Maybe we can get this into the next release cycle? :pray:

liuming50 commented 2 years ago

@troglobit sorry for the delayed feedback, we are currently being blocked by https://github.com/troglobit/finit/issues/216, so have not managed time work on this.

liuming50 commented 2 years ago

@troglobit

Please kindly help me review this V2.

If I understood you correctly, when SM enters SVC_DONE_STATE, we set done condition, and when it enters SVC_HALTED_STATE, we clear the done condition. So I think the svc_set_state function is still the proper place to put the logic in.

troglobit commented 2 years ago

Much better, thank you! :)