Score:2

Preserve order of closing services while shutting down the Linux

gu flag

I defined a Linux systemd service which has few dependencies in unit file using After= and Requires=. My service depends also on SAN filesystems controlled by Veritas.

When stopping my service upon shutdown I noticed my service is stopped after VCS service which prevents my service from stopping gracefully (as it requires filesystems controlled by Veritas to stop which are not present).

I have following dependencies set:

[unit]
After=vcs.service vxfs.service vxvm-boot.service
Requires=vcs.service vxfs.service vxvm-boot.service

Any idea how can I set the right order during shutdown to call my service before Veritas services and which Veritas services I should depend on?

Score:0
jm flag

From the official docs,

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.

Given what you have documented in your .service file, the services should be shut down in the proper order.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.