I think it makes sense to add a new flag along the lines of --delete-incomplete-files-on-exit which should be triggered when a SIGTERM is received. What this flag would do: delete all files from the destination that are in the process of being transferred/copied to by rclone.
This would be tremendously useful for Google Photos since there is no easy way to detect incompletely downloaded files on next rclone run. This flag would ensure that at least no incomplete files are left in place by rclone.
I've discovered some version of this already exists as I encountered it when running this:
timeout -v --preserve-status -k 1m 5280s rclone sync --transfers=10 --max-duration=58m --retries 1 --fast-list --gphotos-include-archived --log-level INFO --log-file=REDACTED.txt gphotos:album album
~25 minutes after --max-duration was reached (elapsed time was 1h23m), rclone gave up on a connection that disappeared and deleted the partially downloaded file.
This helps my original issue if I can figure out how to speed up up the "context deadline exceeded".
But I think this doesn't address the reason I've requested this feature. I think it still makes sense to have the option that if SIGTERM is received by rclone this code should be called before exit (system could be shutting down or process could be getting evicted).
This sounds like the best solution. No need to worry about deletion.
Existence of a partial file at next run could also be used a strong signal to attempt to resume the partial transfer from where it was left interrupted.