systemd units: merge nfs-server.service and nfs-server.target
Subsystems (2)
PATCH 1/1 systemd units: merge nfs-server.service and nfs-server.target
With systemd, a 'service' should run a single server while a 'target' can be used to group services.
As nfs service is really a group of services a 'target' makes more sense. However that means that we need commands like
systemctl start nfs-server.target
rather than the more simple
systemctl start nfs-server
As the target/service separate doesn't bring any gain except a minor aesthetic, and does bring a practical inconvenience, this patch merges nfs-server.target into nfs-server.service.
systemd/README +5 -1
@@ -10,9 +10,13 @@ rpc.rquotad (in the 'quota' package) or rpcbind. There are 4 units that can be 'enabled' or 'disabled' by systemctl, or by a suitable 'preset' setting: - nfs-server.target + nfs-server.service If enabled, nfs service is started together with dependencies such as mountd, statd, rpc.idmapd + This is a "service" file rather than a "target" (which is the + normal grouping construct) so that + systemctl start nfs-server + can work (if no type is given, ".service" is assumed). nfs-client.target If enabled, daemons needs for an nfs client are enabled.
systemd/nfs-server.service +7 -2
@@ -1,8 +1,10 @@ [Unit] -Description=NFS server +Description=NFS server and services DefaultDependencies=no Requires= network.target proc-fs-nfsd.mount rpcbind.target -PartOf=nfs-server.target +Requires= nfs-mountd.service +Wants=rpc-statd.service nfs-idmapd.service rpc-gssd.service rpc-svcgssd.service +Wants=rpc-statd-notify.service After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service After= nfs-idmapd.service rpc-statd.service
@@ -22,3 +24,6 @@ ExecStopPost=/usr/sbin/exportfs -au ExecStopPost=/usr/sbin/exportfs -f ExecReload=/usr/sbin/exportfs -r + +[Install] +WantedBy=multi-user.target
systemd/nfs-server.target deleted +0 -8
@@ -1,8 +0,0 @@ -[Unit] -Description=NFS server services -Requires=nfs-server.service nfs-mountd.service -Wants=rpc-statd.service nfs-idmapd.service rpc-gssd.service rpc-svcgssd.service -Wants=rpc-statd-notify.service - -[Install] -WantedBy=multi-user.target
Quoted 9 lines · NeilBrown
With systemd, a 'service' should run a single server while a 'target' can be used to group services.
As nfs service is really a group of services a 'target' makes more sense. However that means that we need commands like
systemctl start nfs-server.target
rather than the more simple
systemctl start nfs-server
Quoted 6 lines
As the target/service separate doesn't bring any gain except a minor aesthetic, and does bring a practical inconvenience, this patch merges nfs-server.target into nfs-server.service.
Reported-by Steve Dickson <[email protected]>Signed-off-by NeilBrown <[email protected]>
Committed to systemd branch of my git tree...
steved.
Quoted 59 lines
systemd/README +5
-1@@ -10,9 +10,13 @@ rpc.rquotad (in the 'quota' package) or rpcbind. There are 4 units that can be 'enabled' or 'disabled' by systemctl, or by a suitable 'preset' setting: - nfs-server.target + nfs-server.service If enabled, nfs service is started together with dependencies such as mountd, statd, rpc.idmapd + This is a "service" file rather than a "target" (which is the + normal grouping construct) so that + systemctl start nfs-server + can work (if no type is given, ".service" is assumed). nfs-client.target If enabled, daemons needs for an nfs client are enabled.systemd/nfs-server.service +7
-2@@ -1,8 +1,10 @@ [Unit] -Description=NFS server +Description=NFS server and services DefaultDependencies=no Requires= network.target proc-fs-nfsd.mount rpcbind.target -PartOf=nfs-server.target +Requires= nfs-mountd.service +Wants=rpc-statd.service nfs-idmapd.service rpc-gssd.service rpc-svcgssd.service +Wants=rpc-statd-notify.service After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service After= nfs-idmapd.service rpc-statd.service@@ -22,3 +24,6 @@ ExecStopPost=/usr/sbin/exportfs -au ExecStopPost=/usr/sbin/exportfs -f ExecReload=/usr/sbin/exportfs -r + +[Install] +WantedBy=multi-user.targetsystemd/nfs-server.target deleted +0
-8@@ -1,8 +0,0 @@ -[Unit] -Description=NFS server services -Requires=nfs-server.service nfs-mountd.service -Wants=rpc-statd.service nfs-idmapd.service rpc-gssd.service rpc-svcgssd.service -Wants=rpc-statd-notify.service - -[Install] -WantedBy=multi-user.target