As we all know it’s important to make backups of our ROM and settings, especially when flashing regular custom ROM updates.
To automate this I made two Tasker profiles, one that lets you schedule your nandroid backup using OpenRecoveryScript and a second one that takes care of the number of backups kept on your SD (only keeping the last x backups and deleting the older ones) this way your SD won’t be filled with backups.
TWRP backup: line 1 sets the backup interval in days
TWRP backup: line 11 (write file) here you set the backup options as described here. The stock settings are SDCB (System, Data, Cache and Recovey)
TWRP retention: line 1, here you set the number of backups you want to keep.
Set both tasks to run daily.
The nandroid is only been made if the number of days set in the backup interval is passed. The script will always use the last backup for the interval calculation, regardless if it was made by the Tasker script of manually in recovery.