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?