It is possible to create backup scripts and hook them with a backup task. This script is basically a set instruction that can be called upon during the entire backup tasks to accomplish various backup-related tasks, such as starting/stopping a backup, shutting down/suspending a VM, and so on. We can add customized scripts as follows:
script: /etc/pve/script/my-script.pl