Fix and clean up systemd tgt.service unit file#41
Open
JohnAZoidberg wants to merge 5 commits intofujita:masterfrom
Open
Fix and clean up systemd tgt.service unit file#41JohnAZoidberg wants to merge 5 commits intofujita:masterfrom
JohnAZoidberg wants to merge 5 commits intofujita:masterfrom
Conversation
gonzoleeman
reviewed
Jul 30, 2019
scripts/tgtd.service
Outdated
| ExecStart=/usr/sbin/tgtd --foreground | ||
| # Wait for tgtd to be ready | ||
| # See https://bugzilla.redhat.com/show_bug.cgi?id=848942 | ||
| ExecStartPost=/usr/sbin/sleep 5 |
Contributor
There was a problem hiding this comment.
This is kind of ugly. Why not make tgtd only signal systemd is's ready when it's actually ready (using sd_notify())?
Author
There was a problem hiding this comment.
I forgot about sd_notify, thanks! tgtd even already implements this https://github.com/fujita/tgt/blob/master/usr/tgtd.c#L659
systemd issues a warning with the space present Signed-off-by: Daniel Schaefer <git@danielschaefer.me>
Let systemd handle the process management. Type=notify so that the ExecStartPost commands are only executed when the daemon is ready. Signed-off-by: Daniel Schaefer <git@danielschaefer.me>
So that it shows all the underlying tgtadm commands it executes. Makes debugging easier. Also expand the arguments to their full form so that it's clearer what each command does. Signed-off-by: Daniel Schaefer <git@danielschaefer.me>
getty does not seem to be related to this service. Signed-off-by: Daniel Schaefer <git@danielschaefer.me>
Otherwise the daemon will keep running. Signed-off-by: Daniel Schaefer <git@danielschaefer.me>
rdxmb
reviewed
Mar 31, 2021
| ExecStop=/usr/sbin/tgt-admin --verbose --offline ALL | ||
| ExecStop=/usr/sbin/tgt-admin --verbose --update ALL --force --conf /dev/null | ||
| ExecStop=/usr/sbin/tgtadm --op delete --mode system | ||
| ExecStop=/usr/sbin/kill -9 $MAINPID |
There was a problem hiding this comment.
are you sure this is needed? I run tgtd with foreground in a container. And stopping it via https://github.com/fujita/tgt/pull/41/files#diff-f589b6bd883ba54cbe2ebfc7b864d73fde17e245a48cf272fcf8dc9b37ac4969R19-R21 definitely stops the whole process.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The service would fail to run for me. This makes it work and also nicer. See commits:
Maybe you can suggest a better way to wait for tgtd to become ready?