#!/bin/sh
# Format host:username:password
hosts="host1:username1:password1 host2:username2:password2"
###
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
for system in $hosts ; do
host=`echo $system | cut -d : -f 1`
user=`echo $system | cut -d : -f 2`
password=`echo $system | cut -d : -f 3`
log=`mysql -S /tmp/$host-mysql.sock -B --skip-column-names mysql -e "show slave status" | cut -f 6`
if [ ${log} ]; then
mysql -h $host -u $user -p$password -e "PURGE MASTER LOGS TO '$log';"
fi
pid="/home/$host/`hostname`.pid"
kill -HUP `cat $pid`
done
Subscribe to:
Post Comments (Atom)
1 comments:
If you could e-mail me with a few suggestions on just how you made your blog look this excellent, I would be grateful.
Post a Comment