[Unit] Description=MARS TESTING dummy process running on /mnt/test/@{res} Documentation=https://github.com/schoebel/mars/docu/mars-user-manual.pdf ## Markers for the template processor # TESTING_START ## Prohibit parallelism with any daemon-reload After=daemon-reload.service ## HINT: in addition to the combination of BindsTo= with After= as ## documented in "man systemd.unit" to get an _ordering_ dependency for ## startup, it looks like we also need PartOf= to get _another_ ordering ## dependency for _stopping_ in the right order. ## The docs were not particularly clear about this, I found this by testing. ## Comment / uncomment the following, depending on test behaviour: ## This version uses an intermediate "delay" service for testing. ## Notice: the pathname part of the delay service is generated by ## pattern matching from ^{mnt} . Look at the generated units. ## This setup also tests transitive systemd dependencies, where ## BindsTo+After+PartOf is crucial for starting and stopping any ## intermediate units in the right order. #BindsTo=mnt-test-@escvar{res}-delay.service #After=mnt-test-@escvar{res}-delay.service #PartOf=mnt-test-@escvar{res}-delay.service ## Direct version without delay. Use in place of the delay service. BindsTo=mnt-test-@escvar{res}.mount After=mnt-test-@escvar{res}.mount PartOf=mnt-test-@escvar{res}.mount ConditionPathIsMountPoint=/mnt/test/@{res} [Service] Type=simple ExecStart=/etc/marsadm/systemd-templates/SYSTEMD-load-occupy.sh /mnt/test/@{res} ExecStop=/etc/marsadm/systemd-templates/SYSTEMD-load-stop.sh /mnt/test/@{res} # Important for avoiding failures: do not send any signals KillMode=none ## Following is an alternative which does not work due to races. ## Only enable this if you want to trigger such problems for testing. #ExecStop=/usr/bin/killall -r MARS-load #KillMode=mixed [Install] WantedBy=mars.service