I am working on a small project and would like to know if there is a way to execute a function/script if the server is about to shutdown, and if there is a way to hold it for a bit to complete the operations? Thanks!
Edit: I need this to work on a Ubuntu server.