Apple Automator (or similar): performing workflow triggered by shutdown?
Triggering events on shut down is unlikely to be reliable. macOS is not designed to interrupt or pause the shut down process.
If a user is logged in, graphical applications can inadvertently cancel or delay shut down. This behaviour typically occurs when a modal dialog is shown for an unsaved document. In this situation, the preferred solution is to auto-save the work and restore it on next launch; this is considered better than interrupting shut down.
Better to sync periodically or in reaction to changes to a set of files.