This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cpuinfo=`egrep '^flags.*(vmx|svm)' /proc/cpuinfo` | |
if [ "$cpuinfo" = "" ]; then | |
echo "There doesn't appear to be any hardware support for virtualization" | |
exit | |
fi | |
hardware=`dmesg | grep kvm | grep -i 'no hardware support'` | |
bios=`dmesg | grep kvm | grep -i 'disabled by bios'` | |
if [ "$hardware" != "" ]; then | |
echo "No hardware support for KVM" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HAProxy configuration - haproxy-db.cfg | |
## | |
## FRONTEND ## | |
## | |
# Load-balanced IPs for DB writes and reads | |
# | |
frontend db_write | |
bind 172.16.0.50:3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script checks if a mysql server is healthy running on localhost. It will | |
# return: | |
# | |
# "HTTP/1.x 200 OK\r" (if mysql is running smoothly) | |
# | |
# - OR - | |
# | |
# "HTTP/1.x 500 Internal Server Error\r" (else) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# /etc/xinetd.d/mysqlchk | |
# | |
service mysqlchk_write | |
{ | |
flags = REUSE | |
socket_type = stream | |
port = 9200 | |
wait = no | |
user = nobody |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#set -x | |
#define oracle install dir | |
oracle_dir="" | |
if [ -z $oracle_dir ];then | |
echo "your need define oracle install PATH,please open this setting oracle_dir variables" | |
exit 0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Any Failing Command Will Cause The Script To Stop | |
set -e | |
# Treat Unset Variables As Errors | |
set -u | |
NAGIOS_VERSION=3.5.0 | |
PLUGIN_VERSION=1.4.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#description : start realserver | |
VIP=172.16.6.8 | |
/etc/init.d/functions | |
case "$1" in | |
start) | |
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up | |
/sbin/route add -host $SNS_VIP dev lo:0 | |
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore | |
echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function GetPID #User #Name | |
{ | |
PsUser=$1 | |
PsName=$2 | |
pid=`ps -u $PsUser|grep $PsName|grep -v grep|grep -v vi|grep -v dbx \ | |
|grep -v tail|grep -v start|grep -v stop |sed -n 1p |awk '{print $1}'` | |
echo $pid | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MYSQLCONN="mysql -uroot -pxxxx" | |
old_db_name="fff" | |
new_db_name="sj" | |
$MYSQLCONN -e "CREATE DATABASE $new_db_name" | |
params=$($MYSQLCONN -N -e "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='$old_db_name'") | |
for name in $params; do | |
$MYSQLCONN -e "RENAME TABLE $old_db_name.$name to $new_db_name.$name"; | |
done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# chkconfig: 345 60 40 | |
# description: datanode start/stop script | |
### BEGIN INIT INFO | |
# Provides: datanode | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 3 4 5 |