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

Add condition for crashing services #246

Closed
troglobit opened this issue Apr 23, 2022 Discussed in #245 · 6 comments
Closed

Add condition for crashing services #246

troglobit opened this issue Apr 23, 2022 Discussed in #245 · 6 comments
Milestone

Comments

@troglobit
Copy link
Owner

A failing run/task can be detected using conditions task/foo/failure, similar support for services would be very useful.
See below discussion.

Discussed in #245

Originally posted by hongkongkiwi April 23, 2022
Is it possible to add a condition that’s automatically set when a service crashes? e.g <service/myservice/crashed> And additionally <service/myservice/running> ?

I’ve been testing respawn feature but I find I would like to handle crashes and attempt to fix the situation in some cases (E.g restore default mosquito config).

I think this feature could mean you don’t need to extend oncrash: later because a task (or event) can be setup to handle the case of a crash and run a script (or reboot) via the built in signal mechanism

@troglobit troglobit added this to the 4.3 milestone Apr 23, 2022
@hongkongkiwi
Copy link
Contributor

hongkongkiwi commented Apr 25, 2022

Suggested to add for the whole lifecycle, e.g.

service/<name>/ready
service/<name>/starting
service/<name>/setup
service/<name>/running
service/<name>/crashed
service/<name>/stopping
service/<name>/stopped

and any others

Although starting, setup, stopping are only there for a short time, it might be the appropriate time to trigger a task for some cases.

@troglobit
Copy link
Owner Author

troglobit commented Apr 25, 2022

Hmm, gut feeling says no, I'm worried opening up the internal states as an external "ABI" might make it real difficult to change the internals going forward. Sure; running, crashed, and stopped are sort of end states that will always be there. So them I can add.

@hongkongkiwi
Copy link
Contributor

Fair enough, makes sense to keep it trim.

@troglobit
Copy link
Owner Author

Pushed the first implementation last night. When I arrived at the office earlier I was thinking about changing the namespace/prefix from service/ to svc/, not sure though. There's some benefit to aligning the namespace with the .conf setting, I guess.

@hongkongkiwi
Copy link
Contributor

If you want my thoughts on the naming....

I can see what your thinking as svc is short and looks good, it makes it readable when you have lots of conditions... but I guess your not going to change task to tsk right? ;)

To be honest I quite like the current naming because it's really clear what service the condition associated with, and in future if you add extra types then you know clearly what the condition is matching.

@troglobit
Copy link
Owner Author

That was exactly my reasoning as well, plus it's shorter in multi-condition listings. Naming things is suuuuper hard though, and this in particular, because it is one of the things that will survive the big .svc syntax change planned in #148 ... sooooooo yeah. I need to make up my mind before though before the v4.3 release -- try to not uproot users too much between releases. But maybe we'll do #148 in Finit 5, and then we can overhaul the condition namespace as well .. Gah! 🤣

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