[Patch] Added systemd service

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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
From 1b08df8812b7e8e50a76ebc7ab81d5a4b9b77903 Mon Sep 17 00:00:00 2001
From: Timofey Titovets <nefelim4ag@xxxxxxxxx>
Date: Tue, 31 Mar 2015 18:06:50 +0300
Subject: [PATCH] Added systemd service

Signed-off-by: Timofey Titovets <nefelim4ag@xxxxxxxxx>
---
 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


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux