heartbeat监控mysql的脚本
·
1 分钟阅读
·
Shell
#!/bin/bash
pid=/var/mysql/data/host002.pid
time=date '+%H:%M:%S'
Date=date '+%Y.%m.%d'
if [ -f $pid ];then
echo “$time:mysql is running” >>/tmp/chk_mysql.log_$Date
else
echo “$time:mysql is down!stopping heartbeat…” >>/tmp/chk_mysql.log_$Date
&
&
/etc/init.d/heartbeat stop 2
&
1 /dev
ull
&
&
echo “$time:heartbeat has stoped.” >>/tmp
/chk_mysql.log_$Date
sleep 100
&
&
echo “$time:restart heartbeat for standby…”>>/tmp/chk_mysql.log_$Date
&
&
/etc/init.d/heartbeat start 2>
&
1 /dev
ull
&
&
echo “$time:restart heartbeat
successed.”>>/tmp/chk_mysql.log_$Date
#mysql
#监控告警
相关文章
-
#!/bin/bash PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export PATH function trafficmonitor { OSNAME=$(sed -n '1p' /etc/issue) eth=$1
Shell · 3 分钟阅读
-
#!/bin/bash while read line;do done < /tmp/conf.txt
Shell · 1 分钟阅读
-
#!/bin/bash if [ -n "$1" ]; then ethname=$1 else ethname="eth0" fi i=0 sendo=ifconfig $ethname | grep bytes | awk '{print $6}' | awk -F : '{print $2}'
Shell · 2 分钟阅读
-
在文本的最后一行后插入内容: sed -i '$ a\greenlizard-end' content #greenlizard-end为插入的内容。 在第一行前插入: sed -i '1 i\greenlizard-begin' content #greenlizard-begin为插入的内容。
Shell · 2 分钟阅读