1

I have an application running in two containers inside a fedora 33. The containers need to be stopped in a specific way which already has a script for it. To make sure that the containers are always stopped correctly and sequentially before shutdown, i want to customize the system's shutdown process. I found this which seems to suggest i cant directly stop my containers before starting the shutdown process (since systemctl stops everything in parallel). I noticed, however, that the shutdown command is a symbolic link at /usr/sbin/shutdown for some users and at /sbin/shutdown for the root user, both pointing at /bin/systemctl.

Can i simply break both the links and substitute them by a script such as:

#!/bin/bash

echo "doing stuff..."
/bin/systemctl

or will this generate trouble in the future? If yes, is there a more elegant way to guarantee that my containers will always be stopped right before shutdown everytime the shutdown command is called?

1 Answer 1

1

You could do this but... you shouldn't. Since you're on Fedora Linux 33 you're not getting security updates anyway, but if you did, they could very well break ypur kludge.

Instead, I'd suggest using systemd units to manage your containers (that is, make .service files for each), and then you can use the normal After or Requires information to express the dependencies.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .