Contents
- 1 Why does systemd not wait for the unit to finish?
- 2 When to start a service in systemd [ solved ]?
- 3 Why does systemd hang before the sleep 1000 completes?
- 4 How to convince systemd to run a script at shutdown?
- 5 How to control systemd shutdown order / networking, server, server?
- 6 How to ensure that there is a delay before a service is started?
Why does systemd not wait for the unit to finish?
Unless there are ordering dependencies in place, these services can/will be started in parallel. However, multi-user.target (and thus also graphical.target) are not finished until the rc.service finishes. That is why graphical.target is listed as “dead” for 1000 seconds.
When to start a service in systemd [ solved ]?
Services can be started in different ways, as configured with Type=. This determines when a service is considered “started” (or when the service’s start-up is considered finished). When a service reaches this state (some time after being started), units that are supposed to start After= this service will be started (and no sooner).
How are services started in parallel in systemd?
One of the features of systemd is that it starts services in parallel. Your graphical.target wants both multi-user.target and display-manager.service. multi-user.target wants this rc.service (and many other things probably). Unless there are ordering dependencies in place, these services can/will be started in parallel.
Why does systemd hang before the sleep 1000 completes?
The unit is well started (a process sleep 1000 exists). But with a type=forking, systemd is supposed to hang in this case. Instead, the graphical.target is launched, systemctl list-units mention it as dead, but the display manager is started before the sleep 1000 completes.
How to convince systemd to run a script at shutdown?
There must be a way to convince systemd to run a script at shutdown, and wait for it to finish before starting to kill user processes. What am I missing? Anne. *before* systemd starts to kill user processes. Once the shutdown process starts you cannot run your script. Only way is to run your script before calling the process of shutdown.
How to replace systemd shutdown with your own process?
Once the shutdown process starts you cannot run your script. Only way is to run your script before calling the process of shutdown. commands, but that would be a dirty hack. I think that is what exactly you are asking for, “replacing the systemd shutdown/reboot with your own process”
How to control systemd shutdown order / networking, server, server?
According to the manpage for “systemd.unit”: when two units with an ordering dependency between them are shut down, the inverse of the start-up order is applied. i.e. if a unit is configured with After= on another unit, the former is stopped before the latter if both are shut down. So it should be possible to ensure that my service is shut down
How to ensure that there is a delay before a service is started?
So for example, to wait for 1 minute after boot-up before starting your foo.service, create a foo.timer file in the same directory with the contents: It is important that the service is disabled (so it doesn’t start at boot), and the timer enabled, for all this to work (thanks to user tride for this):
Why does Linux wait for network interface to be up?
Since it’s a target, it indicates that the system has reached a particular milestone in the boot process as opposed to just a single service starting. If that doesn’t do it try comparing against another service unit that you know requires a network connection. Thanks for contributing an answer to Unix & Linux Stack Exchange!