We have an internal application with systemd services that we want to deploy outside of the normal systemd directories (/etc/systemd/system and /usr/lib/systemd/system). That location is on another disk (/mnt/data in the example).
The systemd service is enabled by:
systemctl enable /mnt/data/sprinterd.service
which creates a symbolic link in /etc/systemd/system
lrwxrwxrwx. 1 root root 27 Jun 20 22:47 sprinterd.service -> /mnt/data/sprinterd.service
After rebooting, the service is not loaded because the unit file can't be found. From journalctl, first an error that the service failed to load, then after that the mount of the disk where the unit is located.
Cannot add dependency job for unit sprinterd.service, ignoring: Unit sprinterd.service failed to load: No such file or directory. systemd: Mounted /mnt/data.
/dev/disk/by-uuid/c55e944f-5c63-48ad-8cd2-bd32d7b35c82 /mnt/data auto nosuid,nodev,nofail,x-gvfs-show 0 0
For completeness the service unit file:
[Unit] Description=sprinterd [Service] Type=simple Environment=TERM=linux ExecStart=/srv/s1.erp/bin/sprinterd Restart=always RestartSec=5 KillSignal=SIGKILL [Install] WantedBy=multi-user.target
I have tested this on RHEL 7 and on openSuSE 13.2.
Is it supported to have a system service unit file on another disk than /etc or /usr? How could the order of execution between mounting the disk and loading the systemd unit files be changed?