Further reading
Run a script on a systemd system at shutdown: Note that the script doesn't work as it's shown in this article. This is because it has you create the script and save the output files in the /tmp/
directory, which gets cleaned out every time you shut down the machine:
https://www.golinuxcloud.com/run-script-with-systemd-at-shutdown-only-rhel/
How to check the time for a delayed shutdown: You can find the answers to lots of your Linux admin questions with simple DuckDuckGo searches, as I did with this. Learn how to use DuckDuckGo. It can be a Linux administrator's best friend: