Thanx a lot for this script, it was exactly what I was looking for!
I added some code to optimize all tables from all my DBs before the backup is executed. Then I defined the post-variable that specifies the folder of the remote ftp host in which the backup should be put, which was missing.