Systemd dependencies and boot order
I need to specify a boot order for processes to start. I have 389 Directory Server and Samba running on Fedora 18. How can I have the network services boot, then 389 DS, then Samba? Is there a GUI to manage this in Fedora?
I have enabled Samba to start with systemctl enable smb.service
. I have also enabled 389 DS with systemctl enable dirsrv.target
.
Use systemctl edit smb.service
to update the dependencies.
After=dirsrv.target
- Will ensure the smb.service is started after dirsrv.target.
For robustness, (which will be worth while if you're tinkering with this stuff) you may also wish to include some of the following:
Requires=dirsrv.target
- Activate dirsrv.target when smb.service is activated. Will cause smb.service to fail if dirsrv.target fails.
Wants=dirsrv.target
- Activate dirsrv.target when smb.service is activated. Won't cause smb.service to fail if dirsrv.target fails.
BindsTo=dirsrv.target
- If dirsrv.target is deactivated, deactivate smb.service.
Source: http://www.freedesktop.org/software/systemd/man/systemd.unit.html
systemd-ui
provides a GUI for systemd. Gives a good view of the state of systemd but you'll still have to use a text editor to modify the unit files.
Do two things:
-
Edit the
/lib/systemd/system/smb.service
unit file, to specify the dependency. The[unit]
section contains anAfter=
line which specifies what services/targets should be reached before this one.After=syslog.target network.target nmb.service winbind.service
Change it to:
After=dirsrv.target syslog.target network.target nmb.service winbind.service
Report this dependency back to Fedora as a bug, so that it can be incorporated in future releases.
you maybe need to change or include a line with the Requires
directive in the [Unit]
section of the /usr/lib/systemd/system/smb.service
file.
Requires=dirsrv.target
and
After=dirsrv.target