Skip to content

Instantly share code, notes, and snippets.

@kevinbin
kevinbin / oracle_install.sh
Created January 20, 2014 02:51
oracle install script
#!/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
#
# /etc/xinetd.d/mysqlchk
#
service mysqlchk_write
{
flags = REUSE
socket_type = stream
port = 9200
wait = no
user = nobody
#!/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)
# HAProxy configuration - haproxy-db.cfg
##
## FRONTEND ##
##
# Load-balanced IPs for DB writes and reads
#
frontend db_write
bind 172.16.0.50:3306
@kevinbin
kevinbin / check_virt.sh
Created May 17, 2013 05:01
check hardware support virtualization
#!/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"
@kevinbin
kevinbin / nagios_install.sh
Created May 17, 2013 04:55
nagios & nagios plugin install script
#!/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
@kevinbin
kevinbin / sysbench-mysql-format
Created March 31, 2013 03:39
sysbench mysql benchmark result format
awk 'BEGIN {printf "%s%5s%15s%15s\n", "Connect","TPS","QPS","RT"}; {if ($0 ~ /threads:/){printf "%s\t", $4} ;if ($0 ~/transactions:/){sub(/\(/,"");printf "%s\t", $3};if($0~/requests:/){sub(/\(/,"");printf "%s\t",$4};if ($0~/avg:/){print $2}}'
@kevinbin
kevinbin / tpcc-mysql-format
Created March 31, 2013 03:29
tpcc-mysql result format
awk 'BEGIN {printf "%s\t%s\n", "Connect","TpmC"}; {if ($0 ~ /connection/){printf "%s\t", $2} ;if ($0 ~/[0-9].*TpmC/) {print $1}}' tpcc_result_file
#!/bin/sh
# set -x
# Shell script to monitor or watch the disk space
# It will send an email to $ADMIN, if the (free available) percentage of space is >= 90%.
# -------------------------------------------------------------------------
# Set admin email so that you can get email.
ADMIN="root"
# set alert level 90% is default
ALERT=90
# Exclude list of unwanted monitoring, if several partions then use "|" to separate the partitions.
@kevinbin
kevinbin / gist:4094502
Created November 17, 2012 09:34
iptable rule
#!/bin/sh
#
modprobe ipt_MASQUERADE
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
iptables -F
iptables -t nat -F
iptables -X
iptables -t nat -X
###########################INPUT键###################################