From: Timofey Titovets <nefelim4ag@gmail.com>
To: stgt@vger.kernel.org
Subject: [Patch] Added systemd service
Date: Tue, 31 Mar 2015 18:11:28 +0300 [thread overview]
Message-ID: <CAGqmi74fGasr4AYqSF=r_SF29A7yho38S8f2jiJpJ6BDkABZ3Q@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1554 bytes --]
This is my simple implementation of systemd service for tgtd.
I've tested it on my server and it working good enough, i think it can
be useful not only in upstream but and for Debian and Ubuntu packages.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
---
scripts/tgtd.service | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 scripts/tgtd.service
diff --git a/scripts/tgtd.service b/scripts/tgtd.service
new file mode 100644
index 0000000..f31da96
--- /dev/null
+++ b/scripts/tgtd.service
@@ -0,0 +1,31 @@
+[Unit]
+Description=iSCSI target framework daemon
+Documentation=man: tgtd(8)
+After=network.target
+
+# On systems without virtual consoles, don't start any getty. Note
+# that serial gettys are covered by serial-getty@.service, not this
+# unit.
+ConditionPathExists=/etc/tgt/targets.conf
+
+[Service]
+Type=forking
+Environment=TGTD_CONFIG=/etc/tgt/targets.conf
+
+ExecStart=/usr/sbin/tgtd
+ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline
+ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready
+ExecStartPost=/usr/sbin/tgt-admin -e -c ${TGTD_CONFIG}
+
+ExecReload=/usr/sbin/tgt-admin --update ALL -f -c ${TGTD_CONFIG}
+
+ExecStop=/usr/sbin/tgtadm --op update --mode sys --name State -v offline
+ExecStop=/usr/sbin/tgt-admin --offline ALL
+ExecStop=/usr/sbin/tgt-admin --update ALL -c /dev/null -f
+ExecStop=/usr/sbin/tgtadm --op delete --mode system
+
+# Exit code: 107 tgtd not running
+
+
+[Install]
+WantedBy=multi-user.target
--
2.1.4
[-- Attachment #2: 0001-Added-systemd-service.patch --]
[-- Type: text/x-patch, Size: 1546 bytes --]
From 1b08df8812b7e8e50a76ebc7ab81d5a4b9b77903 Mon Sep 17 00:00:00 2001
From: Timofey Titovets <nefelim4ag@gmail.com>
Date: Tue, 31 Mar 2015 18:06:50 +0300
Subject: [PATCH] Added systemd service
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
---
scripts/tgtd.service | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 scripts/tgtd.service
diff --git a/scripts/tgtd.service b/scripts/tgtd.service
new file mode 100644
index 0000000..f31da96
--- /dev/null
+++ b/scripts/tgtd.service
@@ -0,0 +1,31 @@
+[Unit]
+Description=iSCSI target framework daemon
+Documentation=man: tgtd(8)
+After=network.target
+
+# On systems without virtual consoles, don't start any getty. Note
+# that serial gettys are covered by serial-getty@.service, not this
+# unit.
+ConditionPathExists=/etc/tgt/targets.conf
+
+[Service]
+Type=forking
+Environment=TGTD_CONFIG=/etc/tgt/targets.conf
+
+ExecStart=/usr/sbin/tgtd
+ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline
+ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready
+ExecStartPost=/usr/sbin/tgt-admin -e -c ${TGTD_CONFIG}
+
+ExecReload=/usr/sbin/tgt-admin --update ALL -f -c ${TGTD_CONFIG}
+
+ExecStop=/usr/sbin/tgtadm --op update --mode sys --name State -v offline
+ExecStop=/usr/sbin/tgt-admin --offline ALL
+ExecStop=/usr/sbin/tgt-admin --update ALL -c /dev/null -f
+ExecStop=/usr/sbin/tgtadm --op delete --mode system
+
+# Exit code: 107 tgtd not running
+
+
+[Install]
+WantedBy=multi-user.target
--
2.1.4
next reply other threads:[~2015-03-31 15:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-31 15:11 Timofey Titovets [this message]
2015-04-01 7:43 ` [Patch] Added systemd service FUJITA Tomonori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGqmi74fGasr4AYqSF=r_SF29A7yho38S8f2jiJpJ6BDkABZ3Q@mail.gmail.com' \
--to=nefelim4ag@gmail.com \
--cc=stgt@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).