You are not logged in.
Pages: 1
Hello,
I would like to create a target to gather several units, so that it's possible to start and stop the set in once. This target should not be a default one, such as graphical.target, and it should start in the boot process after multi-user.target. The units should start sequentially (unit1, then unit2).
Here are the config files (simplified):
/etc/systemd/system/test_target.target:
[Unit]
Description=test_target
AllowIsolate=false
Requisite=multi-user.target
After=multi-user.target
[Install]
WantedBy=multi-user.target/etc/systemd/system/test_service.service:
[Unit]
Description=test_service
BindsTo=test_target.target
[Service]
ExecStart=/usr/bin/true
ExecStop=/usr/bin/false
SuccessExitStatus=1
Type=oneshot
RemainAfterExit=true
[Install]
WantedBy=test_target.target/etc/systemd/system/data-test_mount.mount:
[Unit]
Description=data-test_mount
Conflicts=umount.target
BindsTo=test_target.target
After=test_service.service
[Mount]
What=/dev/sda
Where=/data/test_mount
TimeoutSec=10s
[Install]
WantedBy=test_target.targetTo refresh systemd config:
systemctl daemon-reloadTo enable the target:
systemctl enable test_target.targetStarting the target or rebooting does not work as intended, units are not started or stopped.
Where do I make a mistake? Are my config files clean? What would you change?
Last edited by zorggy (2017-10-04 10:19:20)
Offline
I think you have to enable all the services and mounts, too. This snippet defines that the unit will be linked to test_target when it is enabled.
[Install]
WantedBy=test_target.targetLast edited by progandy (2017-10-04 09:51:49)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Hello Propagandy,
You are perfectly right, I was missing one of the services in the real life. Thank you very much!
Offline
Pages: 1