Phase 6d hotfix: systemd ExecStart needs %h #76
@@ -6,22 +6,20 @@ Wants=clawstor-cluster.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
# Override via `systemctl --user edit clawstor-fuse.service` when the
|
||||
# install lives elsewhere.
|
||||
Environment=CLAWSTOR_FUSE_BIN=%h/clawstor-deploy/claw-fuse
|
||||
Environment=CLAWSTOR_DATA=%h/clawstor-deploy/data
|
||||
Environment=CLAWSTOR_MOUNT=%h/clawstor-mount
|
||||
# Create the mount point if missing (idempotent). ExecStartPre runs
|
||||
# BEFORE the actual mount; fusermount3 needs an existing dir.
|
||||
ExecStartPre=/bin/mkdir -p ${CLAWSTOR_MOUNT}
|
||||
# systemd expands %h (home) at parse time so the ExecStart binary
|
||||
# path resolves to an absolute path — env-var expansion in the
|
||||
# executable position is NOT supported (results in status=203).
|
||||
# Retarget via `systemctl --user edit clawstor-fuse.service`.
|
||||
# Create the mount point if missing (idempotent).
|
||||
ExecStartPre=/bin/mkdir -p %h/clawstor-mount
|
||||
# Best-effort pre-unmount in case a prior instance left a stale
|
||||
# mount (e.g. daemon SIGKILL). fusermount3's `-u -z` = lazy detach,
|
||||
# harmless when nothing is mounted.
|
||||
ExecStartPre=-/usr/bin/fusermount3 -u -z ${CLAWSTOR_MOUNT}
|
||||
ExecStart=${CLAWSTOR_FUSE_BIN} --data-dir ${CLAWSTOR_DATA} --mount ${CLAWSTOR_MOUNT}
|
||||
# The FUSE binary blocks until unmounted. On systemd stop, send
|
||||
# SIGTERM which fuser translates to a clean unmount.
|
||||
ExecStop=/usr/bin/fusermount3 -u ${CLAWSTOR_MOUNT}
|
||||
# mount (e.g. daemon SIGKILL). Leading `-` = ignore failure.
|
||||
ExecStartPre=-/usr/bin/fusermount3 -u -z %h/clawstor-mount
|
||||
ExecStart=%h/clawstor-deploy/claw-fuse --data-dir %h/clawstor-deploy/data --mount %h/clawstor-mount
|
||||
# The FUSE binary blocks until unmounted. On systemd stop we
|
||||
# unmount explicitly rather than relying on the binary's SIGTERM
|
||||
# handler.
|
||||
ExecStop=/usr/bin/fusermount3 -u %h/clawstor-mount
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user