Closed hongkongkiwi closed 2 years ago
clearing conditions then might be slightly more tricky than currently, you would have to do (if in bash):
rm -f "/run/finit/cond/task/<NAME>/failure" && rm -f "/run/finit/cond/task/<NAME>/failure:"*
No, that's not what the conditions system is supposed to do. Not to mention the unnecessary complexity it would add.
I'd much rather see we handle this as part of #273 instead.
So your thinking is that with the above fix, there can be a catchall script run upon failure which then checks the errorcode using initctl -s status
Yes exactly, 1) task failed, start script, 2) check exit status (and/or state) of task. This moves a lot of the logic to initctl, instead of squeezing it into PID 1.
Does that make sense for your use-case?
Yep, that would work fine thanks!
The post: script action and the just pushed f4d3cf2 should be sufficient for this issue. See #273 for more information.
It would be great if when a task fails, that we can set a condition based on the failure code. This way specific scripts can be done to deal with the results.
For example, lets say we have a script which checks whether a hardware has failed. It can return 0 (success) or (failure) with exit code 1,2,3 so it would be great if for example it failed with error code 1 then it set both
<task/<NAME>/failure>
and<task/<NAME>/failure:1>
error code 2 would look like:<task/<NAME>/failure>
and<task/<NAME>/failure:2>
etcThis would allow specific scripts to run if you know in advance what the error code might be. If you don't know, you can still using the existing
<task/<NAME>/failure>
condition.