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

Allowing Restart=on-failure for Type=oneshot #7474

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,8 @@ static int service_verify(Service *s) {
return -EINVAL;
}

if (s->type == SERVICE_ONESHOT && s->restart != SERVICE_RESTART_NO) {
log_unit_error(UNIT(s), "Service has Restart= setting other than no, which isn't allowed for Type=oneshot services. Refusing.");
if (s->type == SERVICE_ONESHOT && (s->restart != SERVICE_RESTART_NO && s->restart != SERVICE_RESTART_ON_FAILURE)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!IN_SET(s->restart, SERVICE_RESTART_NO, SERVICE_RESTART_ON_FAILURE)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the tip

log_unit_error(UNIT(s), "Service has Restart= setting other than no or on-failure, which are the only allowed for Type=oneshot services. Refusing.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a word missing in that sentence:

which are the only [WHAT] allowed

Maybe "Illegal Restart= setting for service with Type=oneshot; only "no" and "on-failure" are allowed. Ignoring."?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true.

return -EINVAL;
}

Expand Down