Commit 81b45caa authored by abkrim's avatar abkrim

Action var

parent 1c910384
#!/usr/bin/env bash
if [[ $1 == 'debian' ]]; then
ACTION="apt update && apt upgrade"
else
ACTION="/scripts/upcp; yum -y update kernel"
fi
for i in $(cat /root/servers.txt);
do
echo "server "$i;
IFS=":" read -ra SPLIT <<< "$i"
port=$([ ${#SPLIT[@]} == 1 ] && echo "24" || echo ${SPLIT[1]} )
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=5 -p$port root@${SPLIT[0]} "/scripts/upcp; yum -y update kernel";
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=5 -p$port root@${SPLIT[0]} ${ACTION};
done
......@@ -4,8 +4,8 @@ BACKUP_DIR="/path/"
MYSQL_USER="anyuser"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="password"
MYSQLDUMP=/usr/bin/mysqldump
MYSQLCHECK=/usr/bin/mysqlcheck
MYSQLDUMP=$(wich mysqldump)
MYSQLCHECK=$(wich mysqlcheck)
NUMCOPIAS=10
SPECIAL=
CHECK=true
......@@ -29,6 +29,7 @@ function fullBackup() {
$MYSQLCHECK --repair --all-databases
fi
echo "${BACKUP_DIR}full/${TIMESTAMP}.sql.bz2";
$MYSQLDUMP --force --opt --all-databases | bzip2 > "${BACKUP_DIR}full/${TIMESTAMP}.sql.bz2"
ls -t ${BACKUP_DIR}full/*.sql.bz2|sed -e "1,${NUMCOPIAS}d"|xargs -d '\n' rm
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment