[systemd-devel] DefaultDependencies of [Unit]
Lennart Poettering
lennart at poettering.net
Tue Apr 28 02:33:34 PDT 2015
On Tue, 28.04.15 16:19, 樊超 (fcvidos at gmail.com) wrote:
> I want to let my service run when shutdown,and it needn't close by
> systemd,so can i set the DefaultDependencies of [Unit] to "no"?
> I don't understand the meaning of DefaultDependencies.
> It's [Unit] like this:
> After=network.target network-online.target remote-fs.target
> And I want to know if it matters when start the pc if I set
> DefaultDependencies of [Unit] to "no"
Sure it matters. If DefaultDependencies=yes you get ordered after
basic.target and are shut down before shutdown.target is
reached. If you set DefaultDependencies=no you are started really
really early on (unless you explicitly order yourself after
basic.target). That means you'd have to make sure your service is
written in a way it can handle being run that early and doesn't assume
directories like /var are already mounted, or specific other services
already running. Similar, during shutdown if you continue to access
/var this late you will keep the mount for it busy, and accessing
other services might fail earlier than expected.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list