Search This Blog

Monday, September 24, 2007

Small script to check MySQL replication

Small script to check MySQL replication on FreeBSD. Path to mysql.sock as a parameter:

cat /usr/local/opt/check_relication.sh
#!/bin/sh
treshold=1200

### Do not edit below
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin

if [ -z $1 ] ; then
echo "Usage: $0 /path/to/mysql.sock"
exit 255
fi

seconds=`mysql -S $1 -N -e "show slave status\G" | grep Seconds_Behind_Master | cut -d: -f 2`

if [ -z $seconds ] ; then
exit 255
fi

if [ $seconds = "NULL" ]; then
echo Replication kaput!!!
exit 255
fi

if [ $seconds -gt $treshold ]; then
echo Slave behind the master more than $treshold seconds!
fi


Just put to crontab something like this:
*/30 * * * * /usr/local/opt/check_relication.sh /tmp/mysql.sock

11 comments:

chenlina said...

chenlina20150611
oakley sunglasses
hollister clothing
jordan 5
abercrombie and fitch
coach outlet store online
gucci bags
www.louisvuitton.com
michael kors handbags
mont blanc pens
louis vuitton handbags
louis vuitton handbags
hollister kids
michael kors
discount oakley sunglasses
ray ban sungalsses
louis vuitton
louis vuitton outlet
chanel handbags
timberlands
jordan 6 rings
ray ban sunglasses
ray ban outlet
michael kors
coach outlet online
hermes birkin
kevin durant basketball shoes
michael kors outlet online
oakley sunglasses sale
coach factory outlet
kate spade
ray ban outlet
louis vuitton outlet
replica rolex watches
michael kors
gucci handbags
insanity workout
chanel handbags
christian louboutin outlet
hogan outlet
abercrombie store

Da Shuai Guo said...

guowenhao0803
air jordan 4
swarovski crystal
ray ban sunglasses
air max 2014
oakley sunglasses
celine outlet
coach outlet online
barcelona jersey
ray ban sunglasses
new orleans saints jerseys
pandora
louis vuitton outlet
babyliss
cartier love bracelet
coach factory outlet
kobe shoes
coach outlet
vibram fivefingers
nike outlet store
lacoste polo shirts
insanity workout
links of london uk
converse all star
prada shoes
arizona cardinals jerseys
ray ban sunglasses
oakley sunglasses
louis vuitton handbags
instyler ionic styler
juicy couture outlet
cheap mlb jerseys
rolex watches
tory burch outlet
true religion jeans, http://www.truereligionoutletstore.us.com
stuart weitzman boots
cheap football shirts
miami heat jersey
burberry outlet online, http://www.burberryoutletonlinestore.com.co
hollister clothing
nike air max uk

风骚达哥 said...

20150922 junda
abercrombie
Hollister uk
Air Jordan 3 III Retro Free Shipping
louis vuitton
coach outlet
Cheap Jordans For Sale Wholesale
canada goose jackets
Christian Louis Vuitton Red Bottoms
New Louis Vuitton Handbags Outlet
Official Coach Factory Outlet Online Sale
Jordan 13 Shoes For Sale
canada goose outlet
Real Louis Vuitton Bags
nike trainers
Jordan 8 Bugs Bunny
Authentic Louis Vuitton Belts Outlet Store
burberry outlet
Louis Vuitton Bags On Sale
true religion jeans
canada goose outlet online
Lebron James Basketball Shoes Sale
Louis Vuitton Handbags Discount Off
nfl jerseys
Abercrombie T-Shirts
Discount Ray Ban Polarized Sunglasses
coach factory outlet online
Louis Vuitton Outlet USA
celine
Louis Vuitton Luxury Official Website
michael kors outlet

John said...

louis vuitton handbags
louis vuitton
abercrombie & fitch
cheap jordans
cheap uggs for sale
canada goose jackets
christian louboutin outlet
ralph lauren polo
canada goose outlet
michael kors handbags
celine bags
nike roshe run
ugg boots
gucci handbags
michael kors outlet online
coach outlet
ugg outlet
louis vuitton
ugg boots
hollister clothing
toms outlet
coach outlet online
hollister jeans
louis vuitton
louis vuitton outlet online
ugg boots
cheap uggs
coach outlet
louis vuitton outlet stores
oakley sunglasses
gucci shoes
20151125yuanyuan

chenlili said...

2016-4-21 xiaobao
longchamp handbags
christian louboutin outlet
cheap jordan shoes
louis vuitton handbags
coach outlet online
air jordan retro
polo ralph lauren
toms shoes
oakley outlet
adidas uk
michael kors outlet clearance
jordans
fitflop sandals
coach outlet
ray ban sunglasses
michael kors handbags
coach factorty outlet
nike outlet store
tory burch outlet
nike outlet store
ray ban
adidas originals
ugg boots
ray ban wayfarer
ray ban sunglasses
polo ralph lauren
oakley vault
coach factory outlet
christian louboutin outlet
louis vuitton handbags
michael kors outlet online
jordan 8s
michael kors outlet
coach factory outlet
adidas originals shoes
ray ban sunglasses
jordan 13
true religion outlet
air jordans
vans shoes

Gege Dai said...

michael kors outlet online
nfl jersey wholesale
ralph lauren outlet
nba jerseys
jordan 11
toms shoes
salomon shoes sale
ugg outlet store
nike free running
prada handbags
ferragamo shoes
nba jerseys
cheap ray ban sunglasses
cazal sunglasses
ugg boots
abercrombie and fitch
ferragamo shoes
mulberry handbags sale
louis vuitton pas cher
nike outlet
oakley sunglasses
polo ralph lauren
nike outlet store
prada sneakers
christian louboutin shoes
coach outlet
coach outlet
air max 90
ray ban sunglasses
rolex watches
longchamp pliage
burberry sunglasses on sale
michael kors outlet
ralph lauren uk
puma shoes
czq20160726

chenmeinv0 said...

coach outlet online
true religion outlet
tory burch shoes
ugg outlet
hollister jeans
moncler soldes
instyler curling iron
toms outlet
cheap rolex watches
ugg boots
20172.6chenjinyan

shengda xu said...

kd shoes
tory burch outlet online
valentino outlet
yeezy shoes
birkenstock
coach factory outlet online
cheap jordan shoes
louis vuitton outlet online
louis vuitton handbags
ralph lauren sale
xushengda0528

kkk said...

ray ban sunglasses outlet
coach handbags outlet
adidas uk
fitflop
mulberry bags
yeezy boost
montblanc pens
kate spade bags
ray ban sunglasses outlet
nike sneakers
170627yueqin

fangyaoting said...

20180616 junda
canada goose outlet
pandora charms
freshjive clothing
alife clothing
ugg outlet
nfl jersey wholesale
ubiq shoes
chrome hearts outlet
pandora charms sale clearance
cheap jordans

5689 said...

zzzzz2018.7.30
football soldes
pandora jewelry
ugg boots clearance
christian louboutin shoes
football pas cher
golden goose
ugg boots
hermes belt
mbt
nike factory store