#!/bin/sh DBS="$(mysql --user=root --password='xyz' --socket=/mydata/service.sock -Bse 'show databases')" for db in ${DBS[@]} do mysqldump --user=root --password='xyz' \ --socket=/mydata/service.sock --routines $db \ | gzip --best > /BCK_mysql/BCK.${db}-$(date +%Y%m%d).sql.gz & sleep 5 done