Linux Mint is based on Ubuntu, so I'm guesing the runlevel system is probably the same. On Ubuntu, scripts for the different runlevels are executed according to their presence in the
/etc/rc[0-6].d directories. Runlevel 0 corresponds to shutdown, and 6 to reboot.
Typically the script itself is stored in
/etc/init.d, and then symlinks are placed in the directories corresponding to the runlevels you require.
So in your case, write your script, store it in
/etc/init.d/, then create a symlink in each of
/etc/rc6.d (if you want both) pointing to your script.
The scripts in each runlevel directory will be executed in asciibetical order, so if the order within the runlevel matters to you, choose the name of your symlink accordingly.