Run Systemd Script Before System Shutdown

I tried to retain the NGINX FastCGI cache and have it persist across system reboots instead of being ephemeral by default. In order to achieve this goal I needed to create a shell script, define a new systemd service unit, and find a way to run the systemd shell script before shutdown (reboots are included via "Before=" declaration). This site is configured to store the cache in its tmpfs file system, which is a special Linux in-memory file system that abstracts and exposes itself typically to a directory such as /run. When the system is restarted (crashes in my case)

More