2024-10-14 19:15:11 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
user=$1
|
|
|
|
mysql_db=$2
|
|
|
|
dt=$(date +%y%m%d-%T)
|
|
|
|
if [ ! -d /home/$user/_db_backups ]; then
|
|
|
|
mkdir -p /home/$user/_db_backups
|
|
|
|
fi
|
|
|
|
|
2024-10-15 02:30:51 +00:00
|
|
|
/usr/bin/mysqldump $mysql_db > /home/$user/_db_backups/$mysql_db.$dt.sql
|
|
|
|
chown -R $user:$user /home/$user/_db_backups
|
|
|
|
/usr/bin/find /home/$user/_db_backups/ -type f -mmin +360 -delete
|
2024-10-14 19:15:11 +00:00
|
|
|
|
|
|
|
exit 0
|