-
Notifications
You must be signed in to change notification settings - Fork 208
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
Fix and clean up systemd tgt.service unit file #41
base: master
Are you sure you want to change the base?
Conversation
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of ugly. Why not make tgtd only signal systemd is's ready when it's actually ready (using sd_notify())?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
ExecStop=/usr/sbin/tgtadm --op delete --mode system | ||
ExecStop=/usr/sbin/kill -9 $MAINPID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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?