I need to backup on daily basis a huge number of small files to google drive
With ordinary cloud sync task it takes over 24 hours (rate limits, small files etc)
I’ve put down a script that uses restic to backup same data with RESTIC_PACK_SIZE=64
to have bigger files.
sync task has config exluding backed up folder content from sync (do not need rclone to do anything)
My scripts is executed as pre-script of sync task and consumes env vars registered by truenas to get source folder and credentials from sync task config
Works fine. But if I abort sync task , my script keeps running .
Tried to ad traps:
# Cleanup function
cleanup() {
echo "Aborting and cleaning up..." | tee -a "$LOG_FILE"
pkill -P $$ # Kill all child processes of this script
exit 1
}
# Trap termination signals
trap cleanup SIGINT SIGTERM SIGHUP SIGKILL SIGQUIT
No luck. Looks like truenas just looses the process of pre-script when task is aborted.
TrueNas version: ElectricEel-24.10.1