Setup Magerun2
You need to download and configure the Magerun2 script on your system.
Download Shell Script
You can download Magento2 backup script from here. Alternativly, use below command to download script using wget command. You can also copy the script below and paste it in a file on your machine.
Schedule Backup Scrpt
Schedule this script using crontab on your system to run on a daily basis. Use below command to edit crontab configuration: And add below entry at the end of file. Save file and close. You have successfully scheduled cronjob to run on 12:00 AM daily basis. To learn more about using the cronjob read this tutorial.