Eureka!
I do not know, Dave, if you will approve?
Here is an AppleScript which I make run by SD via the option “Run Shell after Copy complete”
We can enable the option as need or leave it always enabled.
---------------------------
tell application "Finder" to eject disk "MyBackup"
-- wait for it
repeat until (list disks) does not contain "MyBackup"
delay 2
end repeat
delay 30
set diskImage to POSIX path of "/Volumes/MyDisk/BackupFolder/MyBackup.sparseimage"
do shell script "/usr/bin/hdiutil compact " & quoted form of diskImage
----------------------------
I used AppleScript editor to write and compile this script and I saved it as application (Compact.app) in Saved Setting. Obviously, if there are several scenarios of backups, each one must have its own adapted script.