mysqlbackup/install.sh

28 lines
506 B
Bash
Raw Normal View History

2020-10-08 14:05:53 -07:00
#!/bin/sh
cp mysqlbackup /usr/local/bin/
chmod 755 /usr/local/bin/mysqlbackup
if [ ! -f /root/.my.cnf ]; then
2020-10-11 21:17:27 -07:00
echo -n "Enter the root MySQL Password: " && stty -echo && read MYSQL_PASS && echo ""
2020-10-11 21:20:31 -07:00
cat <<EOF >> /root/.my.cnf
2020-10-08 14:05:53 -07:00
[client]
user=root
password=${MYSQL_PASS}
[mysqldump]
user=root
password=${MYSQL_PASS}
EOF
2020-10-08 14:53:33 -07:00
chmod 600 /root/.my.cnf
2020-10-08 14:05:53 -07:00
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