Great to see you are sorting out the backup module
Any reason for using bash scripts over PHP? Surely PHP makes for far more cross-platform code - remember Sentora/ZPanel is designed to with all UNIX operating systems and not just Linux. I think it would make more sense to carry on using PHP where possible to maintain compatibility.
Your script is broken on my FreeBSD
but works on Ubuntu

Your script is broken on my FreeBSD


Before posting, update your profile with your OS, Sentora version and server type!