Start a Service After Mounting a Filesystem¶
With the filesystem mounted, use systemctl list-units --type=mount
to locate the unit's name.
Then use a unit file following this template, in /etc/systemd/system/*.service
[Unit] Description=My Service After=${MOUNT_POINT_UNIT_NAME} [Service] Type=oneshot RemainAfterExit=true User=attie Group=attie ExecStart=${MY_SERVICE} [Install] WantedBy=multi-user.target
Subsequently, run the following to enable to service:
systemctl enable ${SERVICE_NAME}
Reference for the unit files here.