This script is intended to be used with BackupPC to dump all databases before running a backup task on a Plesk host using CentOS 7.
The <username>
needs to be a high privilege one.
- create mysqlbackup directory and cd:
mkdir /home/<username>/mysqlbackup
cd /home/<username>/mysqlbackup
- create file on host:
vi mysqldumpbk.sh
- paste mysqldumpbk.sh content:
- make the script executable:
chmod +x /home/<username>/mysqlbackup/mysqldumpbk.sh
- set
$Conf{DumpPreUserCmd}
on BackupPC with:
$sshPath -q -x -l <username> $host sudo /home/<username>/mysqlbackup/mysqldumpbk.sh
- add visudo rule
- root login onto host
visudo
- paste on end of file
#let user <username> use custom mysql backup script without password
<username> ALL=NOPASSWD: /home/<username>/mysqlbackup/mysqldumpbk.sh