This script is intended as EC2 user data.
It will go through multiple steps to recover your mailcow server from a backup.
Please refer to the following article where the complete solution has been explained:
https://96-fromsofia.net/articles/mailcow/
If you have a question you can email me: 2a9-7cc@96-fromsofia.net