aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-extended/tgt/files/tgtd.service
blob: afbd4b4eaad4ef62aeacb00bfbea2bb280fbc1dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[Unit]
Description=tgtd iSCSI target daemon
After=network.target

[Service]
EnvironmentFile=@SYSCONFDIR@/sysconfig/tgtd

ExecStart=@SBINDIR@/tgtd -f $TGTD_OPTS
# see bz 848942. workaround for a race for now.
ExecStartPost=@BASE_BINDIR@/sleep 5
# Put tgtd into "offline" state until all the targets are configured.
# We don't want initiators to (re)connect and fail the connection
# if it's not ready.
ExecStartPost=@SBINDIR@/tgtadm --op update --mode sys --name State -v offline
# Configure the targets.
ExecStartPost=@SBINDIR@/tgt-admin -e -c $TGTD_CONFIG
# Put tgtd into "ready" state.
ExecStartPost=@SBINDIR@/tgtadm --op update --mode sys --name State -v ready

# Update configuration for targets. Only targets which
# are not in use will be updated.
ExecReload=@SBINDIR@/tgt-admin --update ALL -c $TGTD_CONFIG

# NOTE: Shutdown of the iscsi target may cause data corruption
# for initiators that are connected.
ExecStop=@SBINDIR@/tgtadm --op update --mode sys --name State -v offline
# Remove all targets. It only removes targets which are not in use.
ExecStop=@SBINDIR@/tgt-admin --update ALL -c /dev/null
# tgtd will exit if all targets were removed
ExecStop=@SBINDIR@/tgtadm --op delete --mode system

[Install]
WantedBy=multi-user.target