mysqlbackup/install.sh

28 lines
505 B
Bash
Executable File

#!/bin/sh
cp mysqlbackup /usr/local/bin/
chmod 755 /usr/local/bin/mysqlbackup
if [ ! -f /root/.my.cnf ]; then
echo -n "Enter the root MySQL Password: " && stty -echo && read MYSQL_PASS && echo ""
cat <<EOF >> /tmp/.my.cfg
[client]
user=root
password=${MYSQL_PASS}
[mysqldump]
user=root
password=${MYSQL_PASS}
EOF
chmod 600 /root/.my.cnf
fi
if [ ! -e /var/backup/mysql ]; then
mkdir -p /var/backup/mysql
fi
if ! grep mysqlbackup /etc/crontab > /dev/null; then
cat crontab.in >> /etc/crontab
fi